After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 525844 - implicit declaration of function trunc in floaters.c
implicit declaration of function trunc in floaters.c
Status: RESOLVED DUPLICATE of bug 583285
Product: gnome-screensaver
Classification: Deprecated
Component: general
2.20.x
Other All
: Normal minor
: ---
Assigned To: gnome-screensaver maintainers
gnome-screensaver maintainers
Depends on:
Blocks:
 
 
Reported: 2008-04-02 20:45 UTC by Sandro Bonazzola
Modified: 2010-01-29 01:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
solve incompatible implicit declaration of trunc (1.63 KB, patch)
2008-04-08 18:42 UTC, Sandro Bonazzola
none Details | Review

Description Sandro Bonazzola 2008-04-02 20:45:54 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.
Comment 1 William Jon McCann 2008-04-07 22:26:02 UTC
We'd welcome a patch for this.
Comment 2 Sandro Bonazzola 2008-04-08 18:42:11 UTC
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.
Comment 3 Sandro Bonazzola 2008-04-08 18:43:48 UTC
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)) {
Comment 4 William Jon McCann 2010-01-29 01:29:07 UTC
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 ***