Skip to content

Commit

Permalink
🛠 Properly spell default-off, block more things from MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Nov 22, 2023
1 parent 9f72e25 commit 0b89ee9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
/install
/scratch

/main.c
/main.pre.c
/main.cpp
/main.pre.cpp
/0.output
Expand Down
20 changes: 16 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ mark_as_advanced(ZTD_CUNEICODE_SCRATCH)

if(ZTD_CUNEICODE_SCRATCH)
add_executable(scratch main.cpp)
add_executable(scratch_c main.c)
target_link_libraries(scratch PRIVATE ztd::cuneicode)
set_source_files_properties(main.cpp
PROPERTIES LANGUAGE C
)
target_link_libraries(scratch_c PRIVATE ztd::cuneicode)
target_compile_options(scratch
PRIVATE
${--template-debugging-mode}
Expand All @@ -293,5 +292,18 @@ if(ZTD_CUNEICODE_SCRATCH)
${--allow-gnu-statement-expressions}
${--allow-gnu-statement-expression-from-macro-expansion}
)
#target_compile_features(scratch PRIVATE cxx_std_20)
target_compile_options(scratch_c
PRIVATE
${--template-debugging-mode}
${--macro-debugging-mode}
${--updated-cpp-version-flag}
${--warn-pedantic}
${--warn-all}
${--warn-extra}
${--warn-errors}
${--enable-conforming-preprocessor}
${--allow-gnu-auto-type}
${--allow-gnu-statement-expressions}
${--allow-gnu-statement-expression-from-macro-expansion}
)
endif()
4 changes: 2 additions & 2 deletions examples/extensions/source/utf32_to_utf8.stmt_exprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ int main() {
#if ZTD_IS_ON(ZTD_CUNEICODE_EXTENSION_FUNCTIONS)
// This only works if we support extension functions!
const ztd_char32_t input_data[] = U"Bark Bark Bark 🐕‍🦺!";
char output_data[ztdc_c_array_size(input_data) * 4] = { 0 };
cnc_mcstate_t state = { 0 };
ztd_char8_t output_data[ztdc_c_array_size(input_data) * 4] = { 0 };
cnc_mcstate_t state = { 0 };
// set the "do UB shit if invalid" bit to true
cnc_mcstate_set_assume_valid(&state, true);
cnc_c32mc_result_t result = cnc_cxsrtocysn_into(
Expand Down
2 changes: 1 addition & 1 deletion include/ztd/cuneicode/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#elif ZTD_IS_ON(ZTD_STMT_EXPR_USABLE)
#define ZTD_CUNEICODE_EXTENSION_FUNCTIONS_I_ ZTD_DEFAULT_ON
#else
#define ZTD_CUNEICODE_EXTENSION_FUNCTIONS_I_ ZTD_IS_DEFAULT_OFF
#define ZTD_CUNEICODE_EXTENSION_FUNCTIONS_I_ ZTD_DEFAULT_OFF
#endif

#if defined(ZTD_CUNEICODE_INTERMEDIATE_BUFFER_SUGGESTED_BYTE_SIZE)
Expand Down
4 changes: 4 additions & 0 deletions tests/compile_time/source/result_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include <ztd/cuneicode/result.h>

#if ZTD_IS_OFF(ZTD_COMPILER_VCXX) || ZTD_IS_OFF(ZTD_C)

#define MAKE_GENERIC_TYPEDEFS(DECL_NAME) \
typedef DECL_NAME(char, char) ZTD_CONCAT_TOKENS_I_(t, __COUNTER__); \
typedef DECL_NAME(char, unsigned char) ZTD_CONCAT_TOKENS_I_(t, __COUNTER__); \
Expand All @@ -42,3 +44,5 @@ MAKE_GENERIC_TYPEDEFS(cnc_result);
MAKE_GENERIC_TYPEDEFS(cnc_error_result);
MAKE_GENERIC_TYPEDEFS(cnc_single_result);
MAKE_GENERIC_TYPEDEFS(cnc_single_error_result);

#endif
4 changes: 4 additions & 0 deletions tests/compile_time/source/result_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include <ztd/cuneicode/result.h>

#if ZTD_IS_OFF(ZTD_COMPILER_VCXX) || ZTD_IS_OFF(ZTD_C)

#define MAKE_GENERIC_TYPEDEFS(DECL_NAME) \
typedef DECL_NAME(char, char) ZTD_CONCAT_TOKENS_I_(t, __COUNTER__); \
typedef DECL_NAME(char, unsigned char) ZTD_CONCAT_TOKENS_I_(t, __COUNTER__); \
Expand All @@ -42,3 +44,5 @@ MAKE_GENERIC_TYPEDEFS(cnc_result);
MAKE_GENERIC_TYPEDEFS(cnc_error_result);
MAKE_GENERIC_TYPEDEFS(cnc_single_result);
MAKE_GENERIC_TYPEDEFS(cnc_single_error_result);

#endif

0 comments on commit 0b89ee9

Please sign in to comment.