Don't fail to compile if feature macros aren't defined

This makes the output assume the feature is not enabled if the macro is
not defined at all, rather than just being set to zero.

I know of at least one build that does not use CMake and does not set
the macro if the feature is not enabled.
This commit is contained in:
James Ring 2025-03-10 21:19:51 -07:00
parent 766f378590
commit dab80a0480

View File

@ -17,27 +17,84 @@ wasm_proposal_print_status(void)
printf(" - WebAssembly C and C++ API\n"); printf(" - WebAssembly C and C++ API\n");
printf(" Compilation Configurable. 0 is OFF. 1 is ON:\n"); printf(" Compilation Configurable. 0 is OFF. 1 is ON:\n");
printf(" - Bulk Memory Operation via WASM_ENABLE_BULK_MEMORY: %u\n", printf(" - Bulk Memory Operation via WASM_ENABLE_BULK_MEMORY: %u\n",
WASM_ENABLE_BULK_MEMORY); #ifdef WASM_ENABLE_BULK_MEMORY
WASM_ENABLE_BULK_MEMORY
#else
0
#endif
);
printf(" - Fixed-Width SIMD via WASM_ENABLE_SIMD: %u\n", printf(" - Fixed-Width SIMD via WASM_ENABLE_SIMD: %u\n",
WASM_ENABLE_SIMD); #ifdef WASM_ENABLE_SIMD
printf(" - Garbage Collection via WASM_ENABLE_GC: %u\n", WASM_ENABLE_GC); WASM_ENABLE_SIMD
#else
0
#endif
);
printf(" - Garbage Collection via WASM_ENABLE_GC: %u\n",
#ifdef WASM_ENABLE_GC
WASM_ENABLE_GC
#else
0
#endif
);
printf( printf(
" - Legacy Exception Handling via WASM_ENABLE_EXCE_HANDLING: %u\n", " - Legacy Exception Handling via WASM_ENABLE_EXCE_HANDLING: %u\n",
WASM_ENABLE_EXCE_HANDLING); #ifdef WASM_ENABLE_EXCE_HANDLING
WASM_ENABLE_EXCE_HANDLING
#else
0
#endif
);
printf(" - Memory64 via WASM_ENABLE_MEMORY64: %u\n", printf(" - Memory64 via WASM_ENABLE_MEMORY64: %u\n",
WASM_ENABLE_MEMORY64); #ifdef WASM_ENABLE_MEMORY64
WASM_ENABLE_MEMORY64
#else
0
#endif
);
printf(" - Multiple Memory via WASM_ENABLE_MULTI_MEMORY: %u\n", printf(" - Multiple Memory via WASM_ENABLE_MULTI_MEMORY: %u\n",
WASM_ENABLE_MULTI_MEMORY); #ifdef WASM_ENABLE_MULTI_MEMORY
WASM_ENABLE_MULTI_MEMORY
#else
0
#endif
);
printf(" - Reference Types via WASM_ENABLE_REF_TYPES: %u\n", printf(" - Reference Types via WASM_ENABLE_REF_TYPES: %u\n",
WASM_ENABLE_REF_TYPES); #ifdef WASM_ENABLE_REF_TYPES
WASM_ENABLE_REF_TYPES
#else
0
#endif
);
printf(" - Reference-Typed Strings via WASM_ENABLE_REF_TYPES: %u\n", printf(" - Reference-Typed Strings via WASM_ENABLE_REF_TYPES: %u\n",
WASM_ENABLE_REF_TYPES); #ifdef WASM_ENABLE_REF_TYPES
WASM_ENABLE_REF_TYPES
#else
0
#endif
);
printf(" - Tail Call via WASM_ENABLE_TAIL_CALL: %u\n", printf(" - Tail Call via WASM_ENABLE_TAIL_CALL: %u\n",
WASM_ENABLE_TAIL_CALL); #ifdef WASM_ENABLE_TAIL_CALL
WASM_ENABLE_TAIL_CALL
#else
0
#endif
);
printf(" - Threads via WASM_ENABLE_SHARED_MEMORY: %u\n", printf(" - Threads via WASM_ENABLE_SHARED_MEMORY: %u\n",
WASM_ENABLE_SHARED_MEMORY); #ifdef WASM_ENABLE_SHARED_MEMORY
WASM_ENABLE_SHARED_MEMORY
#else
0
#endif
);
printf(" - Typed Function References via WASM_ENABLE_GC: %u\n", printf(" - Typed Function References via WASM_ENABLE_GC: %u\n",
WASM_ENABLE_GC); #ifdef WASM_ENABLE_GC
WASM_ENABLE_GC
#else
0
#endif
);
printf(" Unsupported (>= Phase4):\n"); printf(" Unsupported (>= Phase4):\n");
printf(" - Branch Hinting\n"); printf(" - Branch Hinting\n");
printf(" - Custom Annotation Syntax in the Text Format\n"); printf(" - Custom Annotation Syntax in the Text Format\n");