gnulib warnings during compilation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gnulib warnings during compilation

Rik-4
12/1/14

I'm getting 3 warnings when I compile with -O0, which I do not get when I
compile with -O2.  They are:

--- Warning List ---
system/oct-time.cc:238:38: warning: call to 'localtime' declared with
attribute warning: The symbol ::localtime refers to the system function.
Use gnulib::localtime instead. [enabled by default]
system/oct-time.cc:248:35: warning: call to 'gmtime' declared with
attribute warning: The symbol ::gmtime refers to the system function. Use
gnulib::gmtime instead. [enabled by default]
corefcn/load-save.cc:1204:28: warning: call to 'gmtime' declared with
attribute warning: The symbol ::gmtime refers to the system function. Use
gnulib::gmtime instead. [enabled by default]
--- End Warning List ---

It is true that the code isn't decorated with the gnulib:: prefix so this
is calling the system function.  Is that alright?  Currently configure does
not check that these functions are available using AC_CHECK_FUNC so I
suppose it is possible that someone has a libc which doesn't implement
them.  One approach is to do nothing.  A second would be to add
AC_CHECK_FUNC calls for the gmtime and localtime functions.  A third would
be to add gmtime and localtime to the gnulib bootstrap.conf file and then
decorate these three instances with gnulib::.  Does anyone like one of
these solutions more than another?

Cheers,
Rik


Reply | Threaded
Open this post in threaded view
|

Re: gnulib warnings during compilation

Mike Miller
On Mon, Dec 1, 2014 at 12:38:33 -0800, Rik wrote:

> 12/1/14
>
> I'm getting 3 warnings when I compile with -O0, which I do not get when I
> compile with -O2.  They are:
>
> --- Warning List ---
> system/oct-time.cc:238:38: warning: call to 'localtime' declared with
> attribute warning: The symbol ::localtime refers to the system function.
> Use gnulib::localtime instead. [enabled by default]
> system/oct-time.cc:248:35: warning: call to 'gmtime' declared with
> attribute warning: The symbol ::gmtime refers to the system function. Use
> gnulib::gmtime instead. [enabled by default]
> corefcn/load-save.cc:1204:28: warning: call to 'gmtime' declared with
> attribute warning: The symbol ::gmtime refers to the system function. Use
> gnulib::gmtime instead. [enabled by default]
> --- End Warning List ---
>
> It is true that the code isn't decorated with the gnulib:: prefix so this
> is calling the system function.  Is that alright?  Currently configure does
> not check that these functions are available using AC_CHECK_FUNC so I
> suppose it is possible that someone has a libc which doesn't implement
> them.  One approach is to do nothing.  A second would be to add
> AC_CHECK_FUNC calls for the gmtime and localtime functions.  A third would
> be to add gmtime and localtime to the gnulib bootstrap.conf file and then
> decorate these three instances with gnulib::.  Does anyone like one of
> these solutions more than another?

If the warning is showing up, it means we are already pulling in the
relevant gnulib module. Indeed, the module named "time" covers all of
the standard library declared in time.h. So no changes to
bootstrap.conf needed.

Since we are using much of gnulib already, I'd say we might as well
use the namespaced gnulib::gmtime and gnulib::localtime, and let
gnulib provide a replacement if/when needed.

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: gnulib warnings during compilation

John W. Eaton
Administrator
On 12/01/2014 03:57 PM, Mike Miller wrote:
> On Mon, Dec 1, 2014 at 12:38:33 -0800, Rik wrote:

> Since we are using much of gnulib already, I'd say we might as well
> use the namespaced gnulib::gmtime and gnulib::localtime, and let
> gnulib provide a replacement if/when needed.

I checked in a change to eliminate the warnings on the gui-release and
default branches earlier today.

jwe