help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] Re: GNU Gengetopt 2.22


From: Andre Noll
Subject: Re: [help-gengetopt] Re: GNU Gengetopt 2.22
Date: Wed, 16 Jan 2008 00:14:11 +0100
User-agent: Mutt/1.5.9i

On 22:52, Lorenzo Bettini wrote:

> >OK. Another solution would be to let all object files depend on Makefile
> >which is also generated by configure.
> >
> 
> mhh... but I don't know whether this can be made in a clean way with 
> autotools...

IMHO this has nothing to do with autotools. Wouldn't "%.o: Makefile" in
Makefile.in do the trick?

>   I'm pretty sure that configure for different architectures 
> should be run in different directories...

I tend to disagree: It should also be possible to use the configure
script to reconfigure a software package, either for the same arch
(but using other options for example) or for another arch.

Anyway, it's just a minor issue, so don't worry too much.


[dereferencing type-punned pointer will break strict-aliasing rules]

> >I see. An alternative for getting rid of this warning is to introduce an
> >intermediate (void *) cast:
> >
> >     free_multiple_field (args_info->user_allow_given, (void **)(void 
> >     *)&(args_info->user_allow_arg), &(args_info->user_allow_orig));
> >                                                                   ^^^^^^^^
> 
> well if this does not generate the warning I think that'd be a better 
> solution :-)

Yes, this makes the warning go away.

> >>Actually, I don't get this warning, so thanks for reporting it.
> >
> >You need to compile with -Wstrict-aliasing (included in -Wall) and
> >with -fstrict-aliasing (enabled at levels -O2, -O3, -Os).
> 
> actually I always test compilations with -Wall but I don't get this 
> warning... probably because you're using a different architecture?

You need -Wall _and_ one of the -O flags (or -fstrict-aliasing). I
get the warning on a ubuntu Linux system on x86_64 using gcc-4.1.2,
nothing fancy.

> Is this warning something to worry about?  I mean: I want to remove
> it, but does the warning means that the above code can do something
> wrong?

The warning is harmless if the code doesn't use type-punning (reading
from a different union member than the one most recently written
to). The only union in the files generated by gengetopt is

        union generic_value {
            int int_arg;
            char *string_arg;
        };

for which type-punning doesn't make much sense. So I'm pretty sure
it is harmless.

Regards
Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]