4

A client of mine has a lot of code that uses the "ui64", "ui32", etc... suffixes, and I need to port it.

To avoid a potentially long night verifying several regex find+replaces, I've reproduced said suffixes as user-defined literals.

I'm looking for the "-Wno-xxx" flag for the "not preceded by '_'" warning that pops out as a result.

I've searched the warning list here, but my brain is suffering from rather severe alphabet soup syndrome at the moment, so I likely missed it.

I'm using g++ 4.8.2 that came with cygwin.

defube
  • 2,395
  • 1
  • 22
  • 34
  • The warning is enabled by default and it tells you clearly what's wrong with not preceding it with an underscore: `warning: literal operator suffixes not preceded by '_' are reserved for future standardization [enabled by default]` – Rapptz Jan 20 '14 at 05:54
  • 1
    In situations like these, conformance needs to take a back seat until more serious issues are resolved. It is unhelpful that this warning needs to clutter an already long list of problems. – defube Jan 20 '14 at 06:05
  • 1
    Why can't you just add an underscore to your user defined literal? As it is now, your program is ill formed. – Rapptz Jan 20 '14 at 06:08
  • Just in case it can't easily be done directly, consider applying `grep -v "literal operator suffixes"` or something similar to the compiler output to get rid of it. – Daniel Frey Jan 20 '14 at 06:16
  • 1
    Possible duplicate of [Is it possible to disable GCC warning about missing underscore in user defined literal?](https://stackoverflow.com/questions/15355048/is-it-possible-to-disable-gcc-warning-about-missing-underscore-in-user-defined-l) – ead Aug 28 '19 at 07:58

1 Answers1

2

I believe you're looking for -Wno-literal-suffix.

Since gcc-7 (see here live on godbold), this option also turns off warnings for user defined literal operators without leading underscore:

-Wliteral-suffix (C++ and Objective-C++ only)

...

Additionally, warn when a user-defined literal operator is declared with a literal suffix identifier that doesn’t begin with an underscore. Literal suffix identifiers that don’t begin with an underscore are reserved for future standardization.


You can get GCC to dump all available warning options with the --help=warnings option.

ead
  • 32,758
  • 6
  • 90
  • 153
Michael Burr
  • 333,147
  • 50
  • 533
  • 760
  • Warning still shows up for me. It's enabled by default. See [here](http://coliru.stacked-crooked.com/a/c42501965f3e79f7) – Rapptz Jan 20 '14 at 06:03
  • Weird. It eats the option without complaint, yet it doesn't show up in the list. Still doesn't work, though. – defube Jan 20 '14 at 06:03
  • The documentation is here: http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options The docs also give more details on why the warning exists: " As a conforming extension, GCC treats such suffixes as separate preprocessing tokens in order to maintain backwards compatibility with code that uses formatting macros from ", so you might need to actually **not** ignore the warnings. – Michael Burr Jan 20 '14 at 06:09
  • Conveniently, inttypes.h appears nowhere in the codebase. As an aside, I'd imagine they'd need to be treated separately to facilitate the feature anyway, as coalescing suffixes with their values could make parsing these operators rather complicated. – defube Jan 20 '14 at 06:49