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.
This commit is contained in:
Eric Astor 2023-04-12 19:54:31 +00:00 committed by Marshall Greenblatt
parent 5d48f277f2
commit 55e158fe81
4 changed files with 5 additions and 5 deletions

View File

@ -234,7 +234,7 @@ def format_translation_changes(old, new):
'\n // NOW: '+new['retval'] '\n // NOW: '+new['retval']
if changed: if changed:
result += '\n #pragma message("Warning: "__FILE__": '+new['name']+ \ result += '\n #pragma message("Warning: " __FILE__ ": '+new['name']+ \
' prototype has changed")\n' ' prototype has changed")\n'
return result return result

View File

@ -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 // BEGIN DELETE BEFORE MODIFYING'
result += '\n // AUTO-GENERATED CONTENT' result += '\n // AUTO-GENERATED CONTENT'
result += '\n // COULD NOT IMPLEMENT DUE TO: ' + ', '.join(invalid) 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 // END DELETE BEFORE MODIFYING'
result += '\n}\n\n' result += '\n}\n\n'
return result return result

View File

@ -104,7 +104,7 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped):
result += '\n // BEGIN DELETE BEFORE MODIFYING' result += '\n // BEGIN DELETE BEFORE MODIFYING'
result += '\n // AUTO-GENERATED CONTENT' result += '\n // AUTO-GENERATED CONTENT'
result += '\n // COULD NOT IMPLEMENT DUE TO: ' + ', '.join(invalid) 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 // END DELETE BEFORE MODIFYING'
result += '\n}\n\n' result += '\n}\n\n'
return result return result

View File

@ -30,7 +30,7 @@ output file.
// WARNING - CHANGED RETURN VALUE // WARNING - CHANGED RETURN VALUE
// WAS: void // WAS: void
// NOW: int // 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 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 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 // BEGIN DELETE BEFORE MODIFYING
// AUTO-GENERATED CONTENT // 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 // END DELETE BEFORE MODIFYING
} }