r302003 - Silences gcc's -Wnarrowing.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 00:48:27 PDT 2017


Author: djasper
Date: Wed May  3 02:48:27 2017
New Revision: 302003

URL: http://llvm.org/viewvc/llvm-project?rev=302003&view=rev
Log:
Silences gcc's -Wnarrowing.

I think this is a false positive in GCC's warning, but nonetheless, we
should try to be warning-free. Smaller reproducer (reproduces with GCC
6.3):
https://godbolt.org/g/cJuO2z

Modified:
    cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=302003&r1=302002&r2=302003&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed May  3 02:48:27 2017
@@ -2872,8 +2872,9 @@ void ASTWriter::WritePragmaDiagnosticMap
       [](const DiagnosticsEngine::DiagState *DS) -> unsigned {
     unsigned Result = (unsigned)DS->ExtBehavior;
     for (unsigned Val :
-         {DS->IgnoreAllWarnings, DS->EnableAllWarnings, DS->WarningsAsErrors,
-          DS->ErrorsAsFatal, DS->SuppressSystemWarnings})
+         {(unsigned)DS->IgnoreAllWarnings, (unsigned)DS->EnableAllWarnings,
+          (unsigned)DS->WarningsAsErrors, (unsigned)DS->ErrorsAsFatal,
+          (unsigned)DS->SuppressSystemWarnings})
       Result = (Result << 1) | Val;
     return Result;
   };




More information about the cfe-commits mailing list