rnk added inline comments.

================
Comment at: cfe/trunk/include/clang/Basic/LangOptions.h:217
   /// Adjust BinaryOperator::FPFeatures to match the bit-field size of this.
-  unsigned fp_contract : 1;
+  LangOptions::FPContractModeKind fp_contract : 2;
 };
----------------
anemet wrote:
> rnk wrote:
> > Please do not use bitfields with enum types, it's a good way to break the 
> > build on Windows. This change triggered this clang-cl warning:
> > ```
> > C:\src\llvm-project\clang\include\clang/Basic/LangOptions.h(208,17):  
> > warning: implicit truncation from 'clang::LangOptions::FPContractModeKind' 
> > to bit-field changes value from 2 to -2 [-Wbitfield-constant-conversion]
> >     fp_contract = LangOptions::FPC_Fast;
> >                 ^ ~~~~~~~~~~~~~~~~~~~~~
> > ```
> Noted and thanks for the fix!  Unfortunately the warning wasn't showing up on 
> my host.  I'll take a look why.
Clang doesn't emit that warning on Posix because it wouldn't be true. The 
implicit underlying type of the enum on non-Windows is 'unsigned', not 'int'. 
We could issue a portability warning, but we wouldn't be able to turn it on by 
default because many users don't care about Windows portability.

Anyway, sorry about the bother. This is one of the reasons we just use 
'unsigned' for all our bitfields. =/


Repository:
  rL LLVM

https://reviews.llvm.org/D31167



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to