Skip to content

Commit e1491ff

Browse files
Dag Wanvikfacebook-github-bot
authored andcommitted
Bug#34776172 MacOS: silence deprecated use warnings from XCode >= 14 (#1306)
Summary: - We have much use of sprintf, which is now flagged by clang as unsafe. Silence this, since we have too many uses to rewrite easily. - This version if Xcode also flags loss of precision from 64 to 32 bits integer, silence this also. Typically when x of type size_t is assigned to an int. Change-Id: I3e5f829c7fdb8ddb08c56149bc0db1a5dc277f34 Pull Request resolved: #1306 Reviewed By: hermanlee Differential Revision: D45658644 Pulled By: sunshine-Chun fbshipit-source-id: e5fc7b3
1 parent 3afb4bd commit e1491ff

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmake/maintainer.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ IF(MY_COMPILER_IS_CLANG)
9494
MY_ADD_C_WARNING_FLAG("Wunreachable-code-break")
9595
MY_ADD_C_WARNING_FLAG("Wunreachable-code-return")
9696
ENDIF()
97-
97+
9898
# Extra warning flags for Clang++
9999
IF(MY_COMPILER_IS_CLANG)
100100
# Disable a few default Clang++ warnings
@@ -104,6 +104,17 @@ IF(MY_COMPILER_IS_CLANG)
104104

105105
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wconditional-uninitialized")
106106
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wdeprecated")
107+
108+
# Xcode >= 14 makes noise about sprintf, and loss of precision when
109+
# assigning integers from 64 bits to 32 bits, so silence. We can't
110+
# put these two deprecation exceptions in Darwin.cmake because the
111+
# previous line adding -Wdeprecated would be added later and
112+
# override them, so do it here instead:
113+
IF(APPLE)
114+
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wno-deprecated-declarations")
115+
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wno-shorten-64-to-32")
116+
ENDIF()
117+
107118
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wextra-semi")
108119
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wheader-hygiene")
109120
STRING_APPEND(MY_CXX_WARNING_FLAGS " -Wnon-virtual-dtor")

0 commit comments

Comments
 (0)