[Bug other/78068] warning: implicit declaration of function ‘time’; did you mean ‘nice’? [-Wimplicit-function-declaration]

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 21 21:03:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78068

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> time declaration really is not present in the preprocessed source file.  I
> can't seem to figure out why it is not though.
> 
> I doubt this is a GCC bug rather than a gdb one (sim is considered part of
> gdb) or a glibc one.

David asked me to open this bug.
It is more an aesthetic issue. Clearly the suggestion "nice" is bogus.
I think suggestions should be turned off for -Wimplicit-function-declaration
in general. Other compiler turn them off, too.

markus@x4 tmp % clang -c emul_unix.i
emul_unix.c:818:16: warning: implicit declaration of function 'time' is invalid
in C99 [-Wimplicit-function-declaration]
  time_t now = time ((time_t *)0);
               ^
1 warning generated.

markus@x4 tmp % icc -c emul_unix.i
emul_unix.c(818): warning #266: function "time" declared implicitly
    time_t now = time ((time_t *)0);
                 ^


More information about the Gcc-bugs mailing list