Skip to content

Commit e5ba579

Browse files
javachefacebook-github-bot
authored andcommitted
Enable -Wundef for react-native targets (#49041)
Summary: Pull Request resolved: #49041 Prevent the class of issues seen in D68797482 by making `#if FOO` where `FOO` is not defined an error. Changelog: [Internal] Reviewed By: NickGerleman, sammy-SC Differential Revision: D68824244 fbshipit-source-id: 1291c5f2f84ecb023ba76a015716cc7c9ae0f89e
1 parent 4799463 commit e5ba579

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/react-native/Libraries/Required/RCTRequired.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// the inlining decisions to avoid unnecessary code bloat. In effect RCTRequired
1313
// is a cost-free abstraction in non-DEBUG mode. In DEBUG mode we don't force
1414
// inlining for ease of debugging.
15-
#if DEBUG
15+
#ifdef DEBUG
1616
#define RCTREQUIRED_INLINE inline
1717
#else
1818
#define RCTREQUIRED_INLINE __attribute__((always_inline)) inline

packages/react-native/React/Base/RCTAssert.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ RCT_EXTERN NSString *RCTFormatStackTrace(NSArray<NSDictionary<NSString *, id> *>
157157
/**
158158
* Convenience macro to assert which thread is currently running (DEBUG mode only)
159159
*/
160-
#if DEBUG
160+
#ifdef DEBUG
161161

162162
#define RCTAssertThread(thread, ...) \
163163
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") RCTAssert( \

packages/react-native/React/Base/RCTDefines.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* from release builds to improve performance and reduce binary size.
2828
*/
2929
#ifndef RCT_DEBUG
30-
#if DEBUG
30+
#ifdef DEBUG
3131
#define RCT_DEBUG 1
3232
#else
3333
#define RCT_DEBUG 0
@@ -39,7 +39,7 @@
3939
* such as the debug executors, dev menu, red box, etc.
4040
*/
4141
#ifndef RCT_DEV
42-
#if DEBUG
42+
#ifdef DEBUG
4343
#define RCT_DEV 1
4444
#else
4545
#define RCT_DEV 0

packages/react-native/ReactCommon/react/renderer/graphics/Transform.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
#pragma once
99

1010
#include <array>
11+
#include <string>
1112
#include <vector>
1213

14+
#include <react/renderer/debug/flags.h>
1315
#include <react/renderer/graphics/Float.h>
1416
#include <react/renderer/graphics/Point.h>
1517
#include <react/renderer/graphics/RectangleEdges.h>

0 commit comments

Comments
 (0)