This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: nlmconv.c - warning: value computed is not used
On Wed, Dec 8, 2010 at 7:22 AM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, Dec 08, 2010 at 01:03:55AM +0200, Bernd Jendrissek wrote:
>> In message <477B8342.60604@redhat.com> Nick Clifton wrote:
>> > ? strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
>> > ? ? ? ?NLM_OLD_THREAD_NAME_LENGTH);
>> >
>> >[snip other alternative]
>>
>> This is it in my case.
>
> I wonder do you have a fancy macro for strncpy on your system? ?What
> does the preprocessor output look like here?
Bingo. This is what GCC (4.3.1 with an early-2000s glibc) sees on my system:
(__extension__ (__builtin_constant_p (" LONG") &&
__builtin_constant_p (5) ? (strlen (" LONG") + 1 >= ((size_t) (5)) ?
(char *) memcpy ((((outbfd) -> tdata.nlm_obj_data) ->
nlm_variable_hdr)->oldThreadName, " LONG", 5) : strncpy ((((outbfd) ->
tdata.nlm_obj_data) -> nlm_variable_hdr)->oldThreadName, " LONG", 5))
: strncpy ((((outbfd) -> tdata.nlm_obj_data) ->
nlm_variable_hdr)->oldThreadName, " LONG", 5)));
Casting the call to strncpy to (void) makes the warning go away. I'm
sure this is a non-issue on more recent systems. Thanks for the hint.