Skip to content

Commit c450328

Browse files
committed
Support for --16 on Visual Studio, no _WIN64 in 32-bit mode
1 parent b2c4188 commit c450328

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ansi-c/c_preprocess.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,20 @@ bool c_preprocess_visual_studio(
437437
// yes, both _WIN32 and _WIN64 get defined
438438
command_file << "/D_WIN64" << "\n";
439439
}
440+
else if(config.ansi_c.int_width == 16 && config.ansi_c.pointer_width == 32)
441+
{
442+
// 16-bit LP32 is an artificial architecture we simulate when using --16
443+
DATA_INVARIANT(
444+
pointer_diff_type() == signed_long_int_type(),
445+
"Pointer difference expected to be long int typed");
446+
command_file << "/D__PTRDIFF_TYPE__=long" << '\n';
447+
}
440448
else
441449
{
442450
DATA_INVARIANT(
443451
pointer_diff_type()==signed_int_type(),
444452
"Pointer difference expected to be int typed");
445453
command_file << "/D__PTRDIFF_TYPE__=int" << "\n";
446-
command_file << "/U_WIN64" << "\n";
447454
}
448455

449456
if(config.ansi_c.char_is_unsigned)

0 commit comments

Comments
 (0)