bug-make
[Top][All Lists]
Advanced

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

[bug #66343] building with -Wstring-compare triggers severe warnings


From: anonymous
Subject: [bug #66343] building with -Wstring-compare triggers severe warnings
Date: Thu, 17 Oct 2024 11:27:58 -0400 (EDT)

Follow-up Comment #1, bug #66343 (group make):

These seem to be generated by using the streq() macro:

/* Test if two strings are equal. Is this worthwhile?  Should be profiled. 
*/
#define streq(a, b) \
   ((a) == (b) || \
    (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))

The pre-check for a == b may seem naive to the compiler but it's part of a
reasonable optimization so maybe this warning can be pragma-ed out. OTOH the
comment says it may be overkill so maybe the pre-checks are a waste of time
anyway. For all I know a reasonable compiler may generate similar code for
strcmp calls anyway, it's quite a stable and common function.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66343>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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