GNOME Bugzilla – Bug 525844
implicit declaration of function trunc in floaters.c
Last modified: 2010-01-29 01:29:07 UTC
Please describe the problem: Building the package the compiler warns about incompatible implicit declaration of built-in function trunc in floaters.c. Steps to reproduce: 1. build the package gnome-screensaver 2. 3. Actual results: gcc warn about incompatible declaration of function trunc Expected results: no implicit / incompatible declaration warning because the source should have all the declarations it needs Does this happen every time? yes Other information: The package seems to work fine for now but as a good programming practice, please fix the missing / incompatible declaration in further releases.
We'd welcome a patch for this.
Created attachment 108876 [details] [review] solve incompatible implicit declaration of trunc This bug affects also gnome-screensaver-2.22.0. The problem here is that man trunc says: #include <math.h> double trunc(double x); round to integer, towards zero But in glibc-2.7 math.h there is no trunc declaration. A trunc declaration is present in tgmath.h. Using a simple: #include <tgmath.h> doesn't solve the issue, including other missing definitions. So I propose to use floor instead of trunc: man floor: #include <math.h> double floor(double x); largest integral value not greater than argument that is declared in math.h and obtain the same result of trunc.
Just a trivial patch for removing another warning (unused variable): --- gnome-screensaver-2.22.0.orig/src/gs-window-x11.c 2008-04-08 20:00:38.343822290 +0200 +++ gnome-screensaver-2.22.0/src/gs-window-x11.c 2008-04-08 20:02:46.196822503 +0200 @@ -882,7 +882,6 @@ int standard_error; int child_pid; int id; - int i; error = NULL; if (! g_shell_parse_argv (command, &argc, &argv, &error)) {
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 583285 ***