mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 04:43:53 +00:00
Estimated hours taken: 0.75 Fix some bugs where we were not properly escaping special characters in C strings in the generated code. compiler/llds_out.m: Change a number of places to call output_quoted_c_string instead of io__write_string, so that special characters will be properly escaped. Add new predicate llds_out__quote_c_string, for use by pragma_c_gen.m. compiler/pragma_c_gen.m: Call llds_out__quite_c_string, to ensure that special characters in the generated "pragma_c_raw_code" are properly escaped. tests/valid/int64.m: tests/valid/Mmakefile: Regression test for the above-mentioned bug fix.
19 lines
397 B
Mathematica
19 lines
397 B
Mathematica
% A development version of the Mercury compiler generated
|
|
% invalid C code for this example, because it didn't properly
|
|
% escape special characters such as \ in some of the C strings
|
|
% that it generated.
|
|
|
|
:- module int64.
|
|
|
|
:- interface.
|
|
|
|
:- type int64.
|
|
|
|
:- func int64 /\ int64 = int64.
|
|
|
|
:- implementation.
|
|
|
|
:- type int64 == int.
|
|
|
|
:- pragma c_code((A::in) /\ (B::in) = (C::out), [], "C = A & B;").
|