Skip to content

Commit c0385e9

Browse files
authored
Guard config.w32.h from multiple inclusion (GH-17021)
Besides that is generally good practice to avoid macro redefinitions (and symbol redeclarations), and we're doing this on POSIX platforms anyway, there is a particular issue regarding phpize builds, where config.w32.h actually includes config.pickle.h. The latter overrides some macro definitions (e.g. `PHP_BUILD_SYSTEM`) to define the proper values, but if config.w32.h is included multiple times, different macro definitions eventually raise C4005 compiler warnings[1], which break builds with `/WX /W1` enabled. [1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
1 parent 751eabb commit c0385e9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

win32/build/confutils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,10 @@ function generate_config_h()
22722272

22732273
outfile = FSO.CreateTextFile("main/config.w32.h", true);
22742274

2275+
outfile.WriteLine("#ifndef CONFIG_W32_H");
2276+
outfile.WriteLine("#define CONFIG_W32_H");
2277+
outfile.WriteBlankLines(1);
2278+
22752279
indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix);
22762280
outfile.Write(indata);
22772281

@@ -2319,6 +2323,8 @@ function generate_config_h()
23192323
outfile.WriteLine("#if __has_include(\"main/config.pickle.h\")");
23202324
outfile.WriteLine("#include \"main/config.pickle.h\"");
23212325
outfile.WriteLine("#endif");
2326+
outfile.WriteBlankLines(1);
2327+
outfile.WriteLine("#endif /* CONFIG_W32_H */");
23222328

23232329
outfile.Close();
23242330
}

0 commit comments

Comments
 (0)