meson icon indicating copy to clipboard operation
meson copied to clipboard

`c_compiler.get_define()` returns a string containing a whitespace even though the define is not defined

Open HaSa1002 opened this issue 3 years ago • 1 comments

Describe the bug cc.get_define() is expected to return an empty string if the define is not defined. However, using specific MSVC version this doesn't seem to be guaranteed. This issue is based on the findings in https://github.com/mesonbuild/wrapdb/pull/350

MSVC seems to print random spaces. I think instead of using the current code:

        #ifndef DEFINE
        # define DEFINE
        #endif
        "MESON_GET_DEFINE_DELIMITER"
DEFINE
        #ifndef DEFINE
        "MESON_GET_DEFINE_NDEFINE"
        #endif
        "MESON_GET_DEFINE_DELIMITER"
DEFINE

may be more robust? (This is just something I noticed while reading logs.)

To Reproduce Build the libpng wrap using msvc via the x64 native tools command prompt for VS 2019.

Expected behavior c_compiler.get_define() should return an empty string if the define is not defined.

system parameters

  • Native Build
  • Windows 10
  • Py: 3.10.2
  • 0.61.2

I have to leave my computer now but I wanted to post this issue beforehand. I am happy to provide more info and improve the ticket when I am back.

HaSa1002 avatar Mar 24 '22 13:03 HaSa1002

I'm running into the same problem (meson 0.61.1 and msvc 2022)

nyorain avatar Dec 05 '22 15:12 nyorain