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 libstdc++/67996] std::ios_base::seekdir raises -Wswitch with Clang


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

--- Comment #2 from Kim GrÃsman <kim.grasman at gmail dot com> ---
Thanks, I figured that was why.

The warning is not a problem if I'm using <ios> directly, then I can just
disable it locally.

But we ran into this with a third-party library having the code above in one of
their headers. This makes it nigh-impossible for us to enable -Wswitch for our
own code, as the third-party header could be indirectly included in any
translation unit.

  ios:
     enum seekdir { beg, cur, end, _S_ios_seekdir_end };

  third-party.h:
    switch(seekdir) {
    case beg: break;
    case cur: break;
    case end: break;
    }

  us.cpp:
    #include "third-party.h"  // WARN

I wasn't sure if the extra enumerator was allowed by the standard, so thanks
for confirming that.

We've now worked around it by patching the third-party to use an if/else chain
instead, but I thought I'd raise it anyway because it creates a messy situation
when the warning "leaks" like this.

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