Skip to content

Commit

Permalink
Fix MSVC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
albinahlback committed Nov 18, 2023
1 parent 986a9e6 commit 2d17ae4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 25 deletions.
5 changes: 1 addition & 4 deletions src/calcium/write_si.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ calcium_write_si(calcium_stream_t out, slong x)
else
{
char tmp[22];
if (sizeof(slong) == sizeof(long))
sprintf(tmp, "%ld", x);
else
flint_sprintf(tmp, "%wd", x);
sprintf(tmp, WORD_FMT "d", x);
calcium_write(out, tmp);
}
}
7 changes: 6 additions & 1 deletion src/fmpq_poly/test/t-resultant.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "fmpq.h"
#include "fmpq_poly.h"

#pragma GCC diagnostic ignored "-Woverlength-strings"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Woverlength-strings"
#endif

TEST_FUNCTION_START(fmpq_poly_resultant, state)
{
Expand Down Expand Up @@ -160,3 +162,6 @@ TEST_FUNCTION_START(fmpq_poly_resultant, state)

TEST_FUNCTION_END(state);
}
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
7 changes: 6 additions & 1 deletion src/fmpq_poly/test/t-resultant_div.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "fmpq.h"
#include "fmpq_poly.h"

#pragma GCC diagnostic ignored "-Woverlength-strings"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Woverlength-strings"
#endif

TEST_FUNCTION_START(fmpq_poly_resultant_div, state)
{
Expand Down Expand Up @@ -142,3 +144,6 @@ TEST_FUNCTION_START(fmpq_poly_resultant_div, state)

TEST_FUNCTION_END(state);
}
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
10 changes: 2 additions & 8 deletions src/gr/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ gr_stream_write_si(gr_stream_t out, slong x)
else
{
char tmp[22];
if (sizeof(slong) == sizeof(long))
sprintf(tmp, "%ld", x);
else
flint_sprintf(tmp, "%wd", x);
sprintf(tmp, WORD_FMT "d", x);
gr_stream_write(out, tmp);
}
}
Expand All @@ -90,10 +87,7 @@ gr_stream_write_ui(gr_stream_t out, ulong x)
else
{
char tmp[22];
if (sizeof(ulong) == sizeof(unsigned long))
sprintf(tmp, "%lu", x);
else
flint_sprintf(tmp, "%wu", x);
sprintf(tmp, WORD_FMT "u", x);
gr_stream_write(out, tmp);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/nmod_poly_mat/test/t-set_trunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void test_with_dims(ulong m, ulong n, flint_rand_t state)
flint_printf("FAIL:\n");
nmod_poly_mat_print(a, "X"), flint_printf("\n\n");
nmod_poly_mat_print(b, "X"), flint_printf("\n\n");
printf("truncation length %ld\n\n", len);
flint_printf("truncation length %wd\n\n", len);
fflush(stdout);
flint_abort();
}
Expand All @@ -62,7 +62,7 @@ void test_with_dims(ulong m, ulong n, flint_rand_t state)
nmod_poly_mat_print(a, "X"), flint_printf("\n\n");
nmod_poly_mat_print(b, "X"), flint_printf("\n\n");
nmod_poly_mat_print(c, "X"), flint_printf("\n\n");
printf("truncation length %ld\n\n", len);
flint_printf("truncation length %wd\n\n", len);
fflush(stdout);
flint_abort();
}
Expand All @@ -75,7 +75,7 @@ void test_with_dims(ulong m, ulong n, flint_rand_t state)
flint_printf("FAIL (aliasing):\n");
nmod_poly_mat_print(a, "X"), flint_printf("\n\n");
nmod_poly_mat_print(c, "X"), flint_printf("\n\n");
printf("truncation length %ld\n\n", len);
flint_printf("truncation length %wd\n\n", len);
fflush(stdout);
flint_abort();
}
Expand Down
4 changes: 2 additions & 2 deletions src/qfb/test/t-exponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEST_FUNCTION_START(qfb_exponent, state)
printf("FAIL:\n");
printf("Exponent does not divide class number\n");
printf("Discriminant: "); fmpz_print(D); printf("\n");
printf("%ld does not divide %ld\n", e, num);
flint_printf("%wd does not divide %wd\n", e, num);
flint_abort();
}

Expand All @@ -67,7 +67,7 @@ TEST_FUNCTION_START(qfb_exponent, state)
printf("Exponent does not annihilate form\n");
printf("Discriminant: "); fmpz_print(D); printf("\n");
printf("Form: "); qfb_print(forms + i1); printf("\n");
printf("Exponent: %ld\n", e);
flint_printf("Exponent: %wd\n", e);
flint_abort();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/qfb/test/t-exponent_grh.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEST_FUNCTION_START(qfb_exponent_grh, state)
printf("FAIL:\n");
printf("Exponent does not divide class number\n");
printf("Discriminant: "); fmpz_print(D); printf("\n");
printf("%ld does not divide %ld\n", e, num);
printf("%wd does not divide %wd\n", e, num);
flint_abort();
}

Expand All @@ -67,7 +67,7 @@ TEST_FUNCTION_START(qfb_exponent_grh, state)
printf("Exponent does not annihilate form\n");
printf("Discriminant: "); fmpz_print(D); printf("\n");
printf("Form: "); qfb_print(forms + i1); printf("\n");
printf("Exponent: %ld\n", e);
printf("Exponent: %wd\n", e);
flint_abort();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/qfb/test/t-nucomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST_FUNCTION_START(qfb_nucomp, state)
{
printf("FAIL:\n");
printf("Incorrect discriminant\n");
fmpz_print(D); printf(" should be %ld\n", -i);
fmpz_print(D); printf(" should be %wd\n", -i);
flint_abort();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/qfb/test/t-pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TEST_FUNCTION_START(qfb_pow, state)
if (!result)
{
printf("FAIL:\n");
printf("exp = %lu\n", exp);
printf("exp = %wu\n", exp);
qfb_print(r); printf("\n");
qfb_print(s); printf("\n");
qfb_print(t); printf("\n");
Expand Down
2 changes: 1 addition & 1 deletion src/qfb/test/t-pow_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TEST_FUNCTION_START(qfb_pow_ui, state)
if (!result)
{
printf("FAIL:\n");
printf("exp = %lu\n", exp);
printf("exp = %wu\n", exp);
qfb_print(r); printf("\n");
qfb_print(s); printf("\n");
qfb_print(t); printf("\n");
Expand Down
2 changes: 1 addition & 1 deletion src/qfb/test/t-reduced_forms.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST_FUNCTION_START(qfb_reduced_forms, state)
qfb_print(forms2 + j);
printf("\n");
} else
printf("%ld != %ld\n", num, num2);
flint_printf("%wd != %wd\n", num, num2);

flint_abort();
}
Expand Down

0 comments on commit 2d17ae4

Please sign in to comment.