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.)

Reply via email to