diff --git a/CMakeLists.txt b/CMakeLists.txt index 0864958aa..69169c42e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CLANG) set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-free-nonheap-object") endif() + # -Wstring-concatenation was added in Clang 12.0.0, which corresponds to + # AppleClang 13.0.0 per the table in + # https://en.wikipedia.org/wiki/Xcode#Toolchain_versions + if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0") OR + (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.0.0")) + set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wstring-concatenation") + endif() + if(CLANG OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0") set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wimplicit-fallthrough") endif() diff --git a/crypto/x509/x509_test.cc b/crypto/x509/x509_test.cc index bfd8fa7db..5e089d4b6 100644 --- a/crypto/x509/x509_test.cc +++ b/crypto/x509/x509_test.cc @@ -4634,8 +4634,8 @@ TEST(X509Test, NamePrint) { "/C=US", "/ST=Some State", "/ST=Some Other State \\xE2\\x98\\x83", - "/ST=\\x00A\\x00n\\x00o\\x00t\\x00h\\x00e\\x00r\\x00 " - "\\x00S\\x00t\\x00a\\x00t\\x00e\\x00 &\\x03", + ("/ST=\\x00A\\x00n\\x00o\\x00t\\x00h\\x00e\\x00r\\x00 " + "\\x00S\\x00t\\x00a\\x00t\\x00e\\x00 &\\x03"), "/1.2.840.113554.4.1.72585.2=\\x00\\x00&\\x03", "/1.2.840.113554.4.1.72585.3=0\\x06\\x02\\x01\\x01\\x02\\x01\\x02", "/O=Org Name",