From 55e158fe810cf994d096274e7e120de184c43984 Mon Sep 17 00:00:00 2001 From: Eric Astor Date: Wed, 12 Apr 2023 19:54:31 +0000 Subject: [PATCH] Avoid generating an accidental UDL suffix In the error case, we previously output a pragma with a string immediately followed by __FILE__ - but with no space between the string terminator and __FILE__, a compliant C++ compiler can interpret this as a user-defined literal suffix and end up failing to embed the intended information. We should add spaces here to ensure our generated code is standards-compliant. --- tools/cef_parser.py | 2 +- tools/make_cpptoc_impl.py | 2 +- tools/make_ctocpp_impl.py | 2 +- tools/translator.README.txt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/cef_parser.py b/tools/cef_parser.py index 047b450f6..81c095368 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -234,7 +234,7 @@ def format_translation_changes(old, new): '\n // NOW: '+new['retval'] if changed: - result += '\n #pragma message("Warning: "__FILE__": '+new['name']+ \ + result += '\n #pragma message("Warning: " __FILE__ ": '+new['name']+ \ ' prototype has changed")\n' return result diff --git a/tools/make_cpptoc_impl.py b/tools/make_cpptoc_impl.py index 969245115..5c5c545a2 100644 --- a/tools/make_cpptoc_impl.py +++ b/tools/make_cpptoc_impl.py @@ -71,7 +71,7 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped): result += '\n // BEGIN DELETE BEFORE MODIFYING' result += '\n // AUTO-GENERATED CONTENT' result += '\n // COULD NOT IMPLEMENT DUE TO: ' + ', '.join(invalid) - result += '\n #pragma message("Warning: "__FILE__": ' + name + ' is not implemented")' + result += '\n #pragma message("Warning: " __FILE__ ": ' + name + ' is not implemented")' result += '\n // END DELETE BEFORE MODIFYING' result += '\n}\n\n' return result diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py index d17d3ec1b..a8043e33c 100644 --- a/tools/make_ctocpp_impl.py +++ b/tools/make_ctocpp_impl.py @@ -104,7 +104,7 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped): result += '\n // BEGIN DELETE BEFORE MODIFYING' result += '\n // AUTO-GENERATED CONTENT' result += '\n // COULD NOT IMPLEMENT DUE TO: ' + ', '.join(invalid) - result += '\n #pragma message("Warning: "__FILE__": ' + name + ' is not implemented")' + result += '\n #pragma message("Warning: " __FILE__ ": ' + name + ' is not implemented")' result += '\n // END DELETE BEFORE MODIFYING' result += '\n}\n\n' return result diff --git a/tools/translator.README.txt b/tools/translator.README.txt index 2be478f36..4199d325e 100644 --- a/tools/translator.README.txt +++ b/tools/translator.README.txt @@ -30,7 +30,7 @@ output file. // WARNING - CHANGED RETURN VALUE // WAS: void // NOW: int - #pragma message("Warning: "__FILE__": MyFunction prototype has changed") + #pragma message("Warning: " __FILE__ ": MyFunction prototype has changed") Auto-generated implementations will be added in the new output file for any methods/functions that exist in the CEF header file but did not exist in the @@ -43,7 +43,7 @@ implementation manually. { // BEGIN DELETE BEFORE MODIFYING // AUTO-GENERATED CONTENT - #pragma message("Warning: "__FILE__": frame_new_func is not implemented") + #pragma message("Warning: " __FILE__ ": frame_new_func is not implemented") // END DELETE BEFORE MODIFYING }