Asking help for warning when the macros expand

Now my implement successful run on Windows on these effect:

For example:


This will print “2”.
Now I add “<Python.h>”. On windows, the “pyconfig.h” will define it:

Then you can see the value of “HAVE_FTIME”:
image

Yes. It is not 2.
Then, I add the macro “Py_OMIT_LEGACY_API”:


It recoveries to 2:
image
Then, I undefine the macro “HAVE_FTIME”:

VScode error that “HAVE_FTIME” is not defined:

Now the question is here:
How to define it to ensure that when the macros expand.
The biggest question is that this macro doesn’t warning when be expanded: it error. The other problems can be solved easily.

Now the defination is:

#if defined(__clang__) || defined(__GNUC__)
    #define _PY_WARN_MACRO(msg) _Pragma("GCC warning \"" msg "\"")
#elif defined(_MSC_VER)
    #define _PY_WARN_MACRO(msg) __pragma(message("warning: " msg))
#else
    #define _PY_WARN_MACRO(msg)
#endif

Is there a better way to make it?

Oh no, my fault: didn’t update the name after:(

OK, the question is still here:

C:\Users\hh180\my_python\PEP743_implement\PC/pyconfig_warning.h:13:72: error: expected ';' before string constant
   13 |     #define _Py_Config_Macro_Warning(msg) _Pragma("GCC warning \"" msg "\"")
      |                                                                        ^~~~
C:\Users\hh180\my_python\PEP743_implement\PC/pyconfig_warning.h:111:20: note: in expansion of macro '_Py_Config_Macro_Warning'
  111 | #define HAVE_FTIME _Py_Config_Macro_Warning("macro HAVE_FTIME shouldn't be used")
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
test_macro.c:8:5: note: in expansion of macro 'HAVE_FTIME'
    8 |     HAVE_FTIME
      |     ^~~~~~~~~~
C:\Users\hh180\my_python\PEP743_implement\PC/pyconfig_warning.h:13:76: error: expected statement before ')' token
   13 |     #define _Py_Config_Macro_Warning(msg) _Pragma("GCC warning \"" msg "\"")