mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-13 04:44:39 +00:00
Fix gcc warnings in some test cases.
tests/hard_coded/target_mlobjs_c.c:
Fix a bad use of printf.
tests/hard_coded/trace_goal_4.m:
tests/hard_coded/word_aligned_pointer.m:
tests/hard_coded/word_aligned_pointer_2.m:
tests/tabling/memo_non.m:
tests/tabling/table_foreign_output.m:
tests/tabling/test_enum.m:
Don't assume that MR_Integers are ints; print them using
MR_INTEGER_LENGTH_MODIFIER.
This commit is contained in:
@@ -3,5 +3,5 @@
|
||||
|
||||
void c_write_string(char *string)
|
||||
{
|
||||
printf(string);
|
||||
printf("%s", string);
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
:- implementation.
|
||||
|
||||
main(!IO) :-
|
||||
(
|
||||
( if
|
||||
trace [] impure progress_report(1),
|
||||
fail
|
||||
->
|
||||
then
|
||||
true
|
||||
;
|
||||
else
|
||||
trace [] impure progress_report(2)
|
||||
).
|
||||
|
||||
@@ -30,7 +30,7 @@ main(!IO) :-
|
||||
progress_report(X::in),
|
||||
[will_not_call_mercury, thread_safe, tabled_for_io],
|
||||
"
|
||||
printf(""Progress reported %d\\n"", X);
|
||||
printf(""Progress reported %"" MR_INTEGER_LENGTH_MODIFIER ""d\\n"", X);
|
||||
").
|
||||
|
||||
:- pragma foreign_proc("C#",
|
||||
|
||||
@@ -43,10 +43,10 @@ main(!IO) :-
|
||||
write_bar(Bar, !IO) :-
|
||||
(
|
||||
Bar = yes(Foo),
|
||||
format("yes(0x%x)\n", [i(get_foo(Foo))], !IO)
|
||||
io.format("yes(0x%x)\n", [i(get_foo(Foo))], !IO)
|
||||
;
|
||||
Bar = no,
|
||||
write_string("no", !IO)
|
||||
io.write_string("no", !IO)
|
||||
).
|
||||
|
||||
%---------------------------------------------------------------------------%
|
||||
|
||||
@@ -55,7 +55,8 @@ make_foo = foo(0xcafe).
|
||||
[will_not_call_mercury, promise_pure, thread_safe],
|
||||
"
|
||||
if (X != MR_strip_tag(X)) {
|
||||
fprintf(stderr, ""tag bits not clear in value 0x%x\\n"", X);
|
||||
fprintf(stderr, ""tag bits not clear in value""
|
||||
""0x%"" MR_INTEGER_LENGTH_MODIFIER ""x\\n"", (MR_Unsigned) X);
|
||||
abort();
|
||||
}
|
||||
Int = MR_unmkbody(X);
|
||||
@@ -76,10 +77,10 @@ make_bar = yes(make_foo).
|
||||
write_bar(Bar, !IO) :-
|
||||
(
|
||||
Bar = yes(Foo),
|
||||
format("yes(0x%x)\n", [i(get_foo(Foo))], !IO)
|
||||
io.format("yes(0x%x)\n", [i(get_foo(Foo))], !IO)
|
||||
;
|
||||
Bar = no,
|
||||
write_string("no", !IO)
|
||||
io.write_string("no", !IO)
|
||||
).
|
||||
|
||||
%---------------------------------------------------------------------------%
|
||||
|
||||
@@ -76,6 +76,7 @@ test_multi(A, B, C) :-
|
||||
marker(S::in, A::in, B::in, X::out),
|
||||
[will_not_call_mercury],
|
||||
"
|
||||
printf(""marker executed: %s %d %d\\n"", S, A, B);
|
||||
printf(""marker executed: %s %"" MR_INTEGER_LENGTH_MODIFIER ""d %""
|
||||
MR_INTEGER_LENGTH_MODIFIER ""d\\n"", S, A, B);
|
||||
X = 0;
|
||||
").
|
||||
|
||||
@@ -68,7 +68,7 @@ test_memo(Pairs, F) :-
|
||||
"
|
||||
Foreign *p;
|
||||
|
||||
printf(""make_foreign(%d, %s)\\n"", N, S);
|
||||
printf(""make_foreign(%"" MR_INTEGER_LENGTH_MODIFIER ""d, %s)\\n"", N, S);
|
||||
p = (Foreign *) malloc(sizeof(Foreign));
|
||||
if (p == NULL) {
|
||||
exit(1);
|
||||
@@ -88,7 +88,8 @@ test_memo(Pairs, F) :-
|
||||
"
|
||||
Foreign *p;
|
||||
|
||||
printf(""make_foreign_memo(%d, %s)\\n"", N, S);
|
||||
printf(""make_foreign_memo(%"" MR_INTEGER_LENGTH_MODIFIER ""d, %s)\\n"",
|
||||
N, S);
|
||||
p = (Foreign *) malloc(sizeof(Foreign));
|
||||
if (p == NULL) {
|
||||
exit(1);
|
||||
|
||||
@@ -57,6 +57,6 @@ get_start_state(StartCond, Anchor) = State :-
|
||||
test_exec(In::in, Out::out),
|
||||
[will_not_call_mercury, promise_pure, thread_safe],
|
||||
"
|
||||
printf(""test_exec %d\\n"", In);
|
||||
printf(""test_exec %"" MR_INTEGER_LENGTH_MODIFIER ""d\\n"", In);
|
||||
Out = In + 1;
|
||||
").
|
||||
|
||||
Reference in New Issue
Block a user