Skip to content

Commit

Permalink
Enable pedantic warnings in C++ podspecs (#34404)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #34404

Mirrors D38457812 (063c2b4) and D38632454 (06b55a3), this enables pedantic warnings for iOS in OSS, so that the warning level matches the internal.

This is enabled through the `GCC_WARN_PEDANTIC` xcconfig flag (part of "Apple Clang - Warning Policies"), which controls whether "-pedantic" is passed to clang.

Changelog:
[iOS][Changed] - Enable pedantic warnings in C++ podspecs

Reviewed By: cipolleschi

Differential Revision: D38681644

fbshipit-source-id: 724160fbe03660fcfd12ea0ffeedaab448c66a5f
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Aug 17, 2022
1 parent 4eec473 commit 545c82b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions ReactCommon/React-Fabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
source[:tag] = "v#{version}"
end

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
folly_version = '2021.07.22.00'
folly_dep_name = 'RCT-Folly/Fabric'
boost_compiler_flags = '-Wno-documentation'
Expand Down Expand Up @@ -315,7 +315,8 @@ Pod::Spec.new do |s|
ss.source_files = "react/renderer/leakchecker/**/*.{cpp,h}"
ss.exclude_files = "react/renderer/leakchecker/tests"
ss.header_dir = "react/renderer/leakchecker"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"",
"GCC_WARN_PEDANTIC" => "YES" }
end

s.subspec "runtimescheduler" do |ss|
Expand All @@ -324,13 +325,14 @@ Pod::Spec.new do |s|
ss.source_files = "react/renderer/runtimescheduler/**/*.{cpp,h}"
ss.exclude_files = "react/renderer/runtimescheduler/tests"
ss.header_dir = "react/renderer/runtimescheduler"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
ss.pod_target_xcconfig = {"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"",
"GCC_WARN_PEDANTIC" => "YES" }
end

s.subspec "utils" do |ss|
ss.source_files = "react/utils/*.{m,mm,cpp,h}"
ss.header_dir = "react/utils"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\""}
end

end
5 changes: 3 additions & 2 deletions ReactCommon/React-bridging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
source[:tag] = "v#{version}"
end

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
folly_version = '2021.07.22.00'

Pod::Spec.new do |s|
Expand All @@ -35,7 +35,8 @@ Pod::Spec.new do |s|
s.compiler_flags = folly_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"GCC_WARN_PEDANTIC" => "YES" }

s.dependency "RCT-Folly", folly_version
s.dependency "React-jsi", version
Expand Down
5 changes: 3 additions & 2 deletions ReactCommon/ReactCommon.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
source[:tag] = "v#{version}"
end

folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
folly_version = '2021.07.22.00'
boost_compiler_flags = '-Wno-documentation'

Expand All @@ -34,7 +34,8 @@ Pod::Spec.new do |s|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"GCC_WARN_PEDANTIC" => "YES" }

# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
# Note: Update this only when ready to minimize breaking changes.
Expand Down

0 comments on commit 545c82b

Please sign in to comment.