ANGLE should build with -Wshorten-64-to-32
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 18:56:19 +0000 (18:56 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 18:56:19 +0000 (18:56 +0000)
<http://webkit.org/b/106798>
<http://code.google.com/p/angleproject/issues/detail?id=396>

Reviewed by Kenneth Russell.

Most changes below are simply to document issues with #pragma
statements per request by upstream.  The change to osinclude.h
is the only bug fix, which defines OS_TLSIndex in terms of
pthread_key_t instead of unsigned int since pthread_key_t is a
64-bit value on 64-bit Mac OS X.

* Configurations/Base.xcconfig: Enable -Wshorten-64-to-32 by
setting GCC_WARN_64_TO_32_BIT_CONVERSION to YES.
* src/compiler/Intermediate.cpp:
(TIntermTraverser::hash): Add #pragmas for clang to ignore
-Wshorten-64-to-32 warning.
* src/compiler/MapLongVariableNames.cpp:
(LongNameMap::Size): Ditto.
* src/compiler/ShaderLang.cpp:
(getVariableInfo): Ditto.
(ShGetInfo): Ditto.
* src/compiler/ValidateLimitations.cpp:
(ValidateLimitations::validateFunctionCall): Ditto.
* src/compiler/glslang.l: Ditto.
* src/compiler/glslang_lex.cpp: Ditto.
* src/compiler/osinclude.h: Change type of OS_TLSIndex to
pthread_key_t.  Define OS_INVALID_TLS_INDEX by using
static_cast<OS_TLSIndex>(-1).
* src/compiler/preprocessor/Input.cpp:
(pp::Input::Input): Add #pragmas for clang to ignore
-Wshorten-64-to-32 warning.
* src/compiler/preprocessor/Tokenizer.cpp: Ditto.
* src/compiler/preprocessor/Tokenizer.l: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/Configurations/Base.xcconfig
Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
Source/ThirdParty/ANGLE/src/compiler/MapLongVariableNames.cpp
Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
Source/ThirdParty/ANGLE/src/compiler/ValidateLimitations.cpp
Source/ThirdParty/ANGLE/src/compiler/glslang.l
Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
Source/ThirdParty/ANGLE/src/compiler/osinclude.h
Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp
Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp
Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l

index b5855e39b970010c92fe1ac9c597a39278595026..0373145b0bb63b20284ec109a2e05a75fc83b030 100644 (file)
@@ -1,3 +1,40 @@
+2013-01-15  David Kilzer  <ddkilzer@apple.com>
+
+        ANGLE should build with -Wshorten-64-to-32
+        <http://webkit.org/b/106798>
+        <http://code.google.com/p/angleproject/issues/detail?id=396>
+
+        Reviewed by Kenneth Russell.
+
+        Most changes below are simply to document issues with #pragma
+        statements per request by upstream.  The change to osinclude.h
+        is the only bug fix, which defines OS_TLSIndex in terms of
+        pthread_key_t instead of unsigned int since pthread_key_t is a
+        64-bit value on 64-bit Mac OS X.
+
+        * Configurations/Base.xcconfig: Enable -Wshorten-64-to-32 by
+        setting GCC_WARN_64_TO_32_BIT_CONVERSION to YES.
+        * src/compiler/Intermediate.cpp:
+        (TIntermTraverser::hash): Add #pragmas for clang to ignore
+        -Wshorten-64-to-32 warning.
+        * src/compiler/MapLongVariableNames.cpp:
+        (LongNameMap::Size): Ditto.
+        * src/compiler/ShaderLang.cpp:
+        (getVariableInfo): Ditto.
+        (ShGetInfo): Ditto.
+        * src/compiler/ValidateLimitations.cpp:
+        (ValidateLimitations::validateFunctionCall): Ditto.
+        * src/compiler/glslang.l: Ditto.
+        * src/compiler/glslang_lex.cpp: Ditto.
+        * src/compiler/osinclude.h: Change type of OS_TLSIndex to
+        pthread_key_t.  Define OS_INVALID_TLS_INDEX by using
+        static_cast<OS_TLSIndex>(-1).
+        * src/compiler/preprocessor/Input.cpp:
+        (pp::Input::Input): Add #pragmas for clang to ignore
+        -Wshorten-64-to-32 warning.
+        * src/compiler/preprocessor/Tokenizer.cpp: Ditto.
+        * src/compiler/preprocessor/Tokenizer.l: Ditto.
+
 2013-01-14  David Kilzer  <ddkilzer@apple.com>
 
         Remove nonexistent file in ANGLE Xcode project
index 742c8fc4aff44d2fa89e48f0b5fc2420ce9da367..cc904e8528971a8292f5ad32310b71ce8ca52ce3 100644 (file)
@@ -19,6 +19,7 @@ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 GCC_THREADSAFE_STATICS = NO;
 GCC_TREAT_WARNINGS_AS_ERRORS = YES;
 GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
 GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
 LINKER_DISPLAYS_MANGLED_NAMES = YES;
index 9032b3ae8eda4fcee695d9533d963970510c77cc..5a416d6b67167cb802fab527291ad072a9ae60b9 100644 (file)
@@ -1451,7 +1451,14 @@ TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunctio
 {
     if (hashFunction == NULL || name.empty())
         return name;
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
     khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
     TStringStream stream;
     stream << HASHED_NAME_PREFIX << std::hex << number;
     TString hashedName = stream.str();
index a50310154d0456a608e81c25ad1bd0736a9db271..3246bede32cecbcb696aad07e973e3ee33689116 100644 (file)
@@ -72,7 +72,14 @@ void LongNameMap::Insert(const char* originalName, const char* mappedName)
 
 int LongNameMap::Size() const
 {
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
     return mLongNameMap.size();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
 }
 
 MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
index ab56538c1ebb8f41c15a152cbbdc29e938c1c3b8..3e2068e954d4fb4feffb1c630805e97d1ec9903d 100644 (file)
@@ -62,7 +62,14 @@ static void getVariableInfo(ShShaderInfo varType,
         return;
 
     const TVariableInfo& varInfo = varList[index];
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
     if (length) *length = varInfo.name.size();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
     *size = varInfo.size;
     *type = varInfo.type;
 
@@ -211,13 +218,27 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
         *params = compiler->getInfoSink().obj.size() + 1;
         break;
     case SH_ACTIVE_UNIFORMS:
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
         *params = compiler->getUniforms().size();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
         break;
     case SH_ACTIVE_UNIFORM_MAX_LENGTH:
         *params = 1 +  MAX_SYMBOL_NAME_LEN;
         break;
     case SH_ACTIVE_ATTRIBUTES:
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
         *params = compiler->getAttribs().size();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
         break;
     case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
         *params = 1 + MAX_SYMBOL_NAME_LEN;
@@ -241,7 +262,14 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
         }
         break;
     case SH_HASHED_NAMES_COUNT:
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
         *params = compiler->getNameMap().size();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
         break;
     default: UNREACHABLE();
     }
index d69ec6bbaaa835663fb1b584cd3eee91c6451832..143733b0359ddb52f7f9a0d3a33334739e8e895d 100644 (file)
@@ -427,7 +427,14 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
     for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
         TIntermSymbol* symbol = params[i]->getAsSymbolNode();
         if (symbol && isLoopIndex(symbol))
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
             pIndex.push_back(i);
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
     }
     // If none of the loop indices are used as arguments,
     // there is nothing to check.
index 8300ff63f7045b015d71d16f0ecb576f13d064fa..180695ee8bc582fe737b67a5cb10276e08dc9a21 100644 (file)
@@ -23,6 +23,9 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
 // Ignore errors in auto-generated code.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
 #if defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
index f651df15d9652cd212e85e8b44487463728b6393..90c0dd4dcb720eea86c780366083b671393d931c 100644 (file)
@@ -8,6 +8,9 @@
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
 // Ignore errors in auto-generated code.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
 #if defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
index adf1a3ed331d19cc53a20e3e702a1e54d2c704dd..d8bb1a797c4d8d92fd63542a9e195de50df0688b 100644 (file)
@@ -44,8 +44,8 @@
 typedef DWORD OS_TLSIndex;
 #define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
 #elif defined(ANGLE_OS_POSIX)
-typedef unsigned int OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
+typedef pthread_key_t OS_TLSIndex;
+#define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
 #endif  // ANGLE_OS_WIN
 
 OS_TLSIndex OS_AllocTLSIndex();
index 11868c1cd5b995ff84f1181871452e14fe79e50c..9aae3a10dd37778f645ac31916c6dd90b55b72cc 100644 (file)
@@ -26,7 +26,14 @@ Input::Input(int count, const char* const string[], const int length[]) :
     for (int i = 0; i < mCount; ++i)
     {
         int len = length ? length[i] : -1;
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
         mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
     }
 }
 
index 4a57647741d07ed6575a13ade5ef427d2c153f66..2003ed376ab6a7c75208b20ea4a0723e9bbfb18a 100644 (file)
@@ -520,6 +520,9 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
 #include "DiagnosticsBase.h"
 #include "Token.h"
 
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
 #if defined(__GNUC__)
 // Triggered by the auto-generated yy_fatal_error function.
 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
index 689ae64b0af27441f258d8630357e9477111d5e6..ab1bb7170045cc3598ab49ef9e5c78c779b36df8 100644 (file)
@@ -28,6 +28,9 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
 #include "DiagnosticsBase.h"
 #include "Token.h"
 
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wshorten-64-to-32"
+#endif
 #if defined(__GNUC__)
 // Triggered by the auto-generated yy_fatal_error function.
 #pragma GCC diagnostic ignored "-Wmissing-noreturn"