Skip to content

Commit 2a2a708

Browse files
authored
Change it so that the header files are directly included (#1865)
* Change it so that the header files are directly included Remove the cmake injection and just include the header files as needed * Add missing direct includes for assert, stdint, and string headers * fix up the includes to c variants in c++ code * Fix formatting
1 parent 18eb5db commit 2a2a708

267 files changed

Lines changed: 390 additions & 109 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

analytics/CMakeLists.txt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,28 +129,8 @@ target_compile_definitions(firebase_analytics
129129
PRIVATE
130130
-DINTERNAL_EXPERIMENTAL=1
131131
)
132-
# Automatically include headers that might not be declared.
133-
if(IOS)
134-
if(MSVC)
135-
target_compile_options(firebase_analytics PRIVATE
136-
$<$<NOT:$<COMPILE_LANGUAGE:Swift>>:/FI"assert.h">
137-
$<$<NOT:$<COMPILE_LANGUAGE:Swift>>:/FI"string.h">
138-
$<$<NOT:$<COMPILE_LANGUAGE:Swift>>:/FI"stdint.h">)
139-
else()
140-
target_compile_options(firebase_analytics PRIVATE
141-
$<$<NOT:$<COMPILE_LANGUAGE:Swift>>:SHELL:-include assert.h -include string.h>
142-
)
143-
endif()
144-
else()
145-
if(MSVC)
146-
target_compile_options(firebase_analytics PRIVATE
147-
/FI"assert.h" /FI"string.h" /FI"stdint.h")
148-
else()
149-
target_compile_options(firebase_analytics PRIVATE
150-
SHELL:-include assert.h -include string.h
151-
)
152-
endif()
153-
endif()
132+
133+
154134

155135
if(ANDROID)
156136
firebase_cpp_proguard_file(analytics)

analytics/src/analytics_desktop.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <cstdint>
1516
#include <future>
1617
#include <map>
1718
#include <mutex>

analytics/src/analytics_desktop_dynamic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
// --- Copied from original header ---
2525
#include <stdbool.h>
26+
#include <stddef.h>
2627
#include <stdint.h>
2728

2829
typedef struct GoogleAnalytics_Reserved_Opaque GoogleAnalytics_Reserved;

analytics/src/analytics_ios.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#import "FIRAnalytics+OnDevice.h"
2121
#import "FIRAnalytics.h"
2222

23+
#include <cassert>
24+
#include <cstdint>
2325
#include "analytics/src/analytics_common.h"
2426
#include "analytics/src/include/firebase/analytics.h"
2527

app/CMakeLists.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -308,28 +308,6 @@ else()
308308
set(app_flatbuffers_lib flatbuffers)
309309
endif()
310310

311-
# Automatically include headers that might not be declared.
312-
# We use add_compile_options (instead of target_compile_options) so these
313-
# implicit includes apply globally to all targets in this directory,
314-
# including tests. Generator expressions ($<$<COMPILE_LANGUAGE:...>) are
315-
# used to ensure these C/C++ headers are not passed to the Swift compiler.
316-
if(MSVC)
317-
add_compile_options(
318-
$<$<COMPILE_LANGUAGE:CXX>:/FI"assert.h">
319-
$<$<COMPILE_LANGUAGE:CXX>:/FI"string.h">
320-
$<$<COMPILE_LANGUAGE:CXX>:/FI"stdint.h">)
321-
elseif(APPLE)
322-
add_compile_options(
323-
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include assert.h>"
324-
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include string.h>"
325-
"$<$<COMPILE_LANGUAGE:OBJCXX>:SHELL:-include assert.h>"
326-
"$<$<COMPILE_LANGUAGE:OBJCXX>:SHELL:-include string.h>")
327-
else()
328-
add_compile_options(
329-
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include assert.h>"
330-
"$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include string.h>")
331-
endif()
332-
333311
add_library(firebase_app STATIC
334312
${log_SRCS}
335313
${log_HDRS}

app/rest/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ target_link_libraries(firebase_rest_lib
8686
zlibstatic
8787
${CMAKE_DL_LIBS}
8888
)
89-
# Automatically include headers that might not be declared.
90-
if(MSVC)
91-
add_definitions(/FI"assert.h" /FI"string.h" /FI"stdint.h")
92-
else()
93-
add_definitions(-include assert.h -include string.h)
94-
endif()
9589

9690
# Add shared definitions across all platforms, and then platform specific ones.
9791
add_definitions(

app/rest/controller_curl.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "app/rest/controller_curl.h"
1818

19+
#include <cstdint>
1920
#include <utility>
2021

2122
#include "app/rest/transport_curl.h"

app/rest/gzipheader.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <assert.h>
2121

2222
#include <algorithm>
23+
#include <cstdint>
24+
#include <cstring>
2325

2426
#include "app/src/assert.h"
2527
#include "app/src/util.h"

app/rest/request_json.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef FIREBASE_APP_REST_REQUEST_JSON_H_
1818
#define FIREBASE_APP_REST_REQUEST_JSON_H_
1919

20+
#include <cassert>
2021
#include <string>
2122

2223
#include "app/rest/request.h"

app/rest/request_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef FIREBASE_APP_REST_REQUEST_OPTIONS_H_
1818
#define FIREBASE_APP_REST_REQUEST_OPTIONS_H_
1919

20+
#include <stdint.h>
21+
2022
#include <map>
2123
#include <string>
2224

0 commit comments

Comments
 (0)