[Top][All Lists]

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

Re: [sharutils-4.11.1] Compilation warnings

From: Bruce Korb
Subject: Re: [sharutils-4.11.1] Compilation warnings
Date: Thu, 06 Dec 2012 20:53:33 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2

On 12/06/12 16:01, Paul Eggert wrote:
> You're not the only one.  This problem is common enough
> that we have a gnulib module that solves it.  With
> gnulib you can use the ignore-value module and write this:
> #include <ignore-value.h>
> ...
> ignore_value (system (fil_name));

#  define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))

Years ago, I heard about a compiler optimization test wherein a sample
program could be shown to not have any outputs.  The compiler eliminated
everything and the program exited immediately.  In a similar vein, can
GCC decide that the result of (x) is not really used and still complain?

Also, as it turns out, this usage is actually injected into code that
gets used by client programs.  Consequently, I added the
# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
construct into the injected code.  "Yummy."
Thank you!  Regards, Bruce

reply via email to

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