Enable -Wundef for react-native targets (#49041)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Pieter De Baets
2025-02-03 06:29:28 -08:00
committed by Facebook GitHub Bot
parent 4799463435
commit e5ba5791b2
4 changed files with 6 additions and 4 deletions
@@ -12,7 +12,7 @@
// the inlining decisions to avoid unnecessary code bloat. In effect RCTRequired
// is a cost-free abstraction in non-DEBUG mode. In DEBUG mode we don't force
// inlining for ease of debugging.
#if DEBUG
#ifdef DEBUG
#define RCTREQUIRED_INLINE inline
#else
#define RCTREQUIRED_INLINE __attribute__((always_inline)) inline
+1 -1
View File
@@ -157,7 +157,7 @@ RCT_EXTERN NSString *RCTFormatStackTrace(NSArray<NSDictionary<NSString *, id> *>
/**
* Convenience macro to assert which thread is currently running (DEBUG mode only)
*/
#if DEBUG
#ifdef DEBUG
#define RCTAssertThread(thread, ...) \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") RCTAssert( \
@@ -27,7 +27,7 @@
* from release builds to improve performance and reduce binary size.
*/
#ifndef RCT_DEBUG
#if DEBUG
#ifdef DEBUG
#define RCT_DEBUG 1
#else
#define RCT_DEBUG 0
@@ -39,7 +39,7 @@
* such as the debug executors, dev menu, red box, etc.
*/
#ifndef RCT_DEV
#if DEBUG
#ifdef DEBUG
#define RCT_DEV 1
#else
#define RCT_DEV 0
@@ -8,8 +8,10 @@
#pragma once
#include <array>
#include <string>
#include <vector>
#include <react/renderer/debug/flags.h>
#include <react/renderer/graphics/Float.h>
#include <react/renderer/graphics/Point.h>
#include <react/renderer/graphics/RectangleEdges.h>