Fix a Windows-specific preproc condition

Review Request #2702 — Created Oct. 25, 2023 and submitted

Information

pidgin/pidgin
default

Reviewers

In MSVC 2019, vsnprintf became a real function that correctly matches the C99 standard, and as it's no longer a macro, it cannot be #undef'd. This causes a Macro redefinition conflict with the Standard Library function.

I assume that the only two options here were Mingw and MSVC. I would guess Cygwin would also fall under Mingw. I also assumed that the "not cross-compiling" meant MSVC. So this condition should now correctly target either of those two options.

Compiled on MSVC, and it no longer errored.

Summary ID
Fix a Windows-specific preproc condition
eff18cd71e3f37136072d349887197f68fbef924
Description From Last Updated

Does #ifdef work on non-macros? I didn't think it did, so couldn't we just use #ifdef vsnprintf?

grimgrim
grim
  1. 
      
  2. libpurple/win32/libc_interface.h (Diff revision 1)
     
     
    Show all issues

    Does #ifdef work on non-macros? I didn't think it did, so couldn't we just use #ifdef vsnprintf?

    1. I'm not sure what the ordering of stuff is, but that doesn't seem to work, as the MSVC stdio.h still complains about the redefinition. Also, I don't really know what the Mingw headers do, I just preserved its condition.

    2. Actually, I accidentally did #ifndef instead of #ifdef which does work, but the latter point still stands for now.

    3. Which later point is that, your's or mine? :-D

    4. I mean we could use #ifdef vsnprintf for MSVC, but I'm not sure how the Mingw headers do it.

    5. Gotcha, whatever is fine for now :)

  3. 
      
grim
  1. Great work, thanks!!

  2. 
      
grim
Review request changed
Status:
Completed