From dbd249cace646b25b929e92eb26083a1826fd30f Mon Sep 17 00:00:00 2001 From: dearblue Date: Sat, 17 Jul 2021 20:32:38 +0900 Subject: Output an error if the `INTPTR_MAX` macro is undefined in C++ When doing `conf.enable_cxx_abi` and compiling with FreeBSD + clang or MinGW, such as `INTPTR_MAX` constant macro is not defined if `#include ` precedes `#include `. Currently I get a warning when I use an undefined macro, but if I don't notice it I get confused in a link error. It can be expected that the problem will be easier to understand by making a clear error. Adding `-Werror=undef` as a compiler flag can also result in an error, but this can be a problem if the system header file itself uses undefined macros, for example. This patch does minimal confirmation only, but has no side effects. --- include/mruby.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/mruby.h') diff --git a/include/mruby.h b/include/mruby.h index 93aab5672..77f862356 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -44,6 +44,9 @@ #include #ifdef __cplusplus +#ifndef UINTPTR_MAX +#error Must be placed `#include ` before `#include ` +#endif #ifndef SIZE_MAX #ifdef __SIZE_MAX__ #define SIZE_MAX __SIZE_MAX__ -- cgit v1.2.3