Bug 79708 - -Wlogical-op with duplicate errno symbols
Summary: -Wlogical-op with duplicate errno symbols
Status: RESOLVED DUPLICATE of bug 69602
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-24 18:44 UTC by Peter Eisentraut
Modified: 2024-01-20 17:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Eisentraut 2017-02-24 18:44:41 UTC
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.)
Comment 1 Marek Polacek 2017-02-24 18:52:47 UTC
Looks like an exact dup of PR69602.

*** This bug has been marked as a duplicate of bug 69602 ***