Skip to content

Commit

Permalink
Re-enable default -Wmaybe-uninitialized; disable selectively in files…
Browse files Browse the repository at this point in the history
… with false positives
  • Loading branch information
fredrik-johansson committed Feb 2, 2025
1 parent a71fd14 commit 60fd983
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 1 deletion.
2 changes: 2 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ AH_VERBATIM([PRAGMAS],
#define DIAGNOSTIC_IGNORE_CAST_FUNCTION_TYPE
#define DIAGNOSTIC_IGNORE_OVERLENGTH_STRINGS
#define DIAGNOSTIC_IGNORE_UNUSED_VARIABLE
#define DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED
/* Define the following to what optimization pragmas your compiler allows. */
#define PUSH_OPTIONS
Expand Down Expand Up @@ -273,6 +274,7 @@ then
FLINT_CHECK_PRAGMA([diagnostic ignored \"-Wcast-function-type\"],[DIAGNOSTIC_IGNORE_CAST_FUNCTION_TYPE])
FLINT_CHECK_PRAGMA([diagnostic ignored \"-Woverlength-strings\"],[DIAGNOSTIC_IGNORE_OVERLENGTH_STRINGS])
FLINT_CHECK_PRAGMA([diagnostic ignored \"-Wunused-variable\"],[DIAGNOSTIC_IGNORE_UNUSED_VARIABLE])
FLINT_CHECK_PRAGMA([diagnostic ignored \"-Wmaybe-uninitialized\"],[DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED])
FLINT_CHECK_PRAGMA([push_options],[PUSH_OPTIONS])
FLINT_CHECK_PRAGMA([pop_options],[POP_OPTIONS])
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ then
gcc_cflags="-O3 "
fi
gcc_cflags="$gcc_cflags-pedantic -std=c11"
gcc_warnings="-Werror=implicit-function-declaration -Wall -Wno-stringop-overread -Wno-stringop-overflow -Wno-maybe-uninitialized"
gcc_warnings="-Werror=implicit-function-declaration -Wall -Wno-stringop-overread -Wno-stringop-overflow"

dnl We only try to provide specifics for those systems that currently supports
dnl our assembly routines. If more combinations are wished for than what is
Expand Down
5 changes: 5 additions & 0 deletions src/acb/dot_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "acb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
acb_dot_fmpz(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, const fmpz * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -143,3 +146,5 @@ acb_dot_fmpz(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/acb/dot_si.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "acb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
acb_dot_si(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, const slong * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -74,3 +77,5 @@ acb_dot_si(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xst

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/acb/dot_siui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "acb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

static void
arf_shallow_set_siui(arf_t res, ulong vhi, ulong vlo)
{
Expand Down Expand Up @@ -112,3 +115,5 @@ acb_dot_siui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/acb/dot_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "acb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
acb_dot_ui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -72,3 +75,5 @@ acb_dot_ui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong xst

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/acb/dot_uiui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "acb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

static void
arf_shallow_set_uiui(arf_t res, ulong vhi, ulong vlo)
{
Expand Down Expand Up @@ -103,3 +106,5 @@ acb_dot_uiui(acb_t res, const acb_t initial, int subtract, acb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/arb/dot_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "arb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
arb_dot_fmpz(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, const fmpz * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -142,3 +145,5 @@ arb_dot_fmpz(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/arb/dot_si.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "arb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
arb_dot_si(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, const slong * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -73,3 +76,5 @@ arb_dot_si(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xst

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/arb/dot_siui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "arb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

static void
arf_shallow_set_siui(arf_t res, ulong vhi, ulong vlo)
{
Expand Down Expand Up @@ -110,3 +113,5 @@ arb_dot_siui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/arb/dot_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "arb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void
arb_dot_ui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xstep, const ulong * y, slong ystep, slong len, slong prec)
{
Expand Down Expand Up @@ -71,3 +74,5 @@ arb_dot_ui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong xst

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/arb/dot_uiui.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "arb.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

static void
arf_shallow_set_uiui(arf_t res, ulong vhi, ulong vlo)
{
Expand Down Expand Up @@ -101,3 +104,5 @@ arb_dot_uiui(arb_t res, const arb_t initial, int subtract, arb_srcptr x, slong x

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/fmpz_mod_mpoly/set_coeff_fmpz_fmpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "mpoly.h"
#include "fmpz_mod_mpoly.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void _fmpz_mod_mpoly_set_coeff_fmpz_fmpz(
fmpz_mod_mpoly_t A,
const fmpz_t c,
Expand Down Expand Up @@ -123,3 +126,5 @@ void fmpz_mod_mpoly_set_coeff_si_fmpz(fmpz_mod_mpoly_t poly,
fmpz_mod_mpoly_set_coeff_fmpz_fmpz(poly, C, exp, ctx);
fmpz_clear(C);
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/fmpz_poly/evaluate_horner_d_2exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "fmpz.h"
#include "fmpz_poly.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

/* Naive double+exponent arithmetic; not designed to deal with
underflow/overflow. */
typedef struct
Expand Down Expand Up @@ -198,3 +201,5 @@ double fmpz_poly_evaluate_horner_d_2exp(slong * exp, const fmpz_poly_t poly, dou

return _fmpz_poly_evaluate_horner_d_2exp(exp, poly->coeffs, poly->length, d);
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/mpoly/min_fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

#include "mpoly.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

/* this file does not need to change with new orderings */

/* unpack the field-wise minimum of poly_exps into min_fields */
Expand Down Expand Up @@ -80,3 +83,5 @@ void mpoly_min_fields_fmpz(fmpz * min_fields, const ulong * poly_exps,

TMP_END;
}

POP_OPTIONS
5 changes: 5 additions & 0 deletions src/nmod_poly/multi_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <stdlib.h>
#include "nmod_poly.h"

PUSH_OPTIONS
DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED

void nmod_poly_multi_crt_init(nmod_poly_multi_crt_t P)
{
P->prog = NULL;
Expand Down Expand Up @@ -500,3 +503,5 @@ void _nmod_poly_multi_crt_run_p(
}
}
}

POP_OPTIONS

0 comments on commit 60fd983

Please sign in to comment.