Skip to content

Commit

Permalink
masm: fix -Wundef warnings
Browse files Browse the repository at this point in the history
Change the compiler/platform detection macros to check whether a macro
is defined, before testing its value. See also the discussion at

https://bugs.webkit.org/show_bug.cgi?id=167643
https://codereview.qt-project.org/c/qt/qtbase/+/618094

Task-number: QTBUG-132900
Change-Id: Ic3cc02b23e034cc7622e899b4acc381166a9ec95
Reviewed-by: Ulf Hermann <[email protected]>
  • Loading branch information
dangelog committed Feb 21, 2025
1 parent 277121d commit 8e57beb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/3rdparty/masm/wtf/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
#define WTF_Compiler_h

/* COMPILER() - the compiler being used to build the project */
#define COMPILER(WTF_FEATURE) WTF_COMPILER_##WTF_FEATURE
#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE)

/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */
#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE
#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE)

/* COMPILER_QUIRK() - whether the compiler being used to build the project requires a given quirk. */
#define COMPILER_QUIRK(WTF_COMPILER_QUIRK) WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK
#define COMPILER_QUIRK(WTF_COMPILER_QUIRK) (defined WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK && WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK)

/* ==== COMPILER() - the compiler being used to build the project ==== */

Expand Down
12 changes: 6 additions & 6 deletions src/3rdparty/masm/wtf/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/* ==== PLATFORM handles OS, operating environment, graphics API, and
CPU. This macro will be phased out in favor of platform adaptation
macros, policy decision macros, and top-level port definitions. ==== */
#define PLATFORM(WTF_FEATURE) WTF_PLATFORM_##WTF_FEATURE
#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE)


/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
Expand All @@ -48,20 +48,20 @@
#ifdef Q_OS_VXWORKS
#undef CPU
#endif // Q_OS_VXWORKS
#define CPU(WTF_FEATURE) WTF_CPU_##WTF_FEATURE
#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
/* HAVE() - specific system features (headers, functions or similar) that are present or not */
#define HAVE(WTF_FEATURE) HAVE_##WTF_FEATURE
#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
/* OS() - underlying operating system; only to be used for mandated low-level services like
virtual memory, not to choose a GUI toolkit */
#define OS(WTF_FEATURE) WTF_OS_##WTF_FEATURE
#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE)


/* ==== Policy decision macros: these define policy choices for a particular port. ==== */

/* USE() - use a particular third-party library or optional OS service */
#define USE(WTF_FEATURE) WTF_USE_##WTF_FEATURE
#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE)
/* ENABLE() - turn on a specific feature of WebKit */
#define ENABLE(WTF_FEATURE) ENABLE_##WTF_FEATURE
#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)


/* ==== CPU() - the target CPU architecture ==== */
Expand Down

0 comments on commit 8e57beb

Please sign in to comment.