This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79708] New: -Wlogical-op with duplicate errno symbols


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79708

            Bug ID: 79708
           Summary: -Wlogical-op with duplicate errno symbols
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peter at eisentraut dot org
  Target Milestone: ---

This is an attempt to write portable code:

    #include <errno.h>

    int
    main()
    {
            if (errno == EWOULDBLOCK || errno == EAGAIN)
                    return 1;
            return 0;
    }

At some point, gcc -Wlogical-op started warning about this with:

    test.c:6:27: warning: logical ‘or’ of equal expressions [-Wlogical-op]

This is unfortunate, because I find -Wlogical-op useful otherwise.

Could the warning be modified to realize when the duplicate values are from
macros expansion?  (I'm aware of the difference between preprocessor and
compiler and that this might be difficult.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]