Skip to content

Commit 1dd236b

Browse files
committed
CppUTest: fix integer conversion warning in gettid()
The cast is required since syscall() provides a generalized interface. See, e.g. https://github.com/elogind/elogind/blob/06e702c9dafa3ea1dd6df8ee8cb4dcf417a0d442/src/basic/missing_syscall.h#L76-L87 [19/113] Building CXX object lib/CppUTest/CMakeFiles/CppUTest.dir/src/UtestPlatformGcc.cpp.o ../lib/CppUTest/src/UtestPlatformGcc.cpp: In function ‘pid_t gettid()’: ../lib/CppUTest/src/UtestPlatformGcc.cpp:59:50: warning: conversion to ‘pid_t {aka int}’ from ‘long int’ may alter its value [-Wconversion] static inline pid_t gettid(void) { return syscall( __NR_gettid ); } ~~~~~~~^~~~~~~~~~~~~~~
1 parent 2f00495 commit 1dd236b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/CppUTest/src/UtestPlatformGcc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
// kernel 2.4.11. Library support was added in glibc 2.30. (Earlier
5757
// glibc versions did not provide a wrapper for this system call,
5858
// necessitating the use of syscall(2).)
59-
static inline pid_t gettid(void) { return syscall( __NR_gettid ); }
59+
static inline pid_t gettid(void) { return (pid_t)syscall(__NR_gettid); }
6060
#endif
6161

6262
#include "CppUTest/PlatformSpecificFunctions.h"

0 commit comments

Comments
 (0)