Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing declarations runner #1921

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
49 changes: 45 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,56 @@ jobs:
# gcc build check no regressions
##############################################################################
gcc-build-regression-check:
name: GCC build regression check (no tests)
name: GCC build check -Wextra

runs-on: ubuntu-latest

env:
CC: "gcc"
CFLAGS: "-march=native -std=c11 -Wall -Wextra -Werror"
MODULES: "build/thread_pool_merged.lo build/thread_support_merged.lo build/ulong_extras_merged.lo build/long_extras_merged.lo build/perm_merged.lo build/double_extras_merged.lo build/d_vec_merged.lo build/d_mat_merged.lo build/mpn_extras_merged.lo build/mpfr_vec_merged.lo build/mpfr_mat_merged.lo build/nmod_merged.lo build/nmod_vec_merged.lo build/nmod_mat_merged.lo build/nmod_poly_merged.lo build/mpn_mod_merged.lo build/fmpz_merged.lo build/fmpz_vec_merged.lo build/fmpz_mat_merged.lo build/fmpz_poly_merged.lo build/fmpz_mod_merged.lo build/fmpz_mod_vec_merged.lo build/fmpz_mod_mat_merged.lo build/fmpz_mod_poly_merged.lo build/fmpq_merged.lo build/fmpq_vec_merged.lo build/fmpq_mat_merged.lo build/fmpq_poly_merged.lo build/fq_merged.lo build/fq_vec_merged.lo build/fq_mat_merged.lo build/fq_poly_merged.lo build/fq_nmod_merged.lo build/fq_nmod_vec_merged.lo build/fq_nmod_mat_merged.lo build/fq_nmod_poly_merged.lo build/fq_zech_merged.lo build/fq_zech_mat_merged.lo build/fq_zech_poly_merged.lo build/fq_default_merged.lo build/fq_default_mat_merged.lo build/fq_default_poly_merged.lo build/fq_embed_merged.lo build/fq_nmod_embed_merged.lo build/fq_zech_embed_merged.lo build/padic_merged.lo build/padic_mat_merged.lo build/padic_poly_merged.lo build/qadic_merged.lo build/nmod_poly_factor_merged.lo build/fmpz_factor_merged.lo build/fmpz_poly_factor_merged.lo build/fmpz_mod_poly_factor_merged.lo build/fq_poly_factor_merged.lo build/fq_nmod_poly_factor_merged.lo build/fq_zech_poly_factor_merged.lo build/fq_default_poly_factor_merged.lo build/nmod_poly_mat_merged.lo build/fmpz_poly_mat_merged.lo build/mpoly_merged.lo build/nmod_mpoly_merged.lo build/fmpz_mpoly_merged.lo build/fmpz_mod_mpoly_merged.lo build/fmpq_mpoly_merged.lo build/fq_nmod_mpoly_merged.lo build/fq_zech_mpoly_merged.lo"
# Everything until mpoly_factor stuff
CFLAGS: "-march=native -std=c11 -Wall -Wextra -Werror -Wno-error=pragmas"
MODULES: "build/thread_pool_merged.lo build/thread_support_merged.lo build/ulong_extras_merged.lo build/long_extras_merged.lo build/perm_merged.lo build/double_extras_merged.lo build/d_vec_merged.lo build/d_mat_merged.lo build/mpn_extras_merged.lo build/mpfr_vec_merged.lo build/mpfr_mat_merged.lo build/nmod_merged.lo build/nmod_vec_merged.lo build/nmod_mat_merged.lo build/nmod_poly_merged.lo build/mpn_mod_merged.lo build/fmpz_merged.lo build/fmpz_vec_merged.lo build/fmpz_mat_merged.lo build/fmpz_poly_merged.lo build/fmpz_mod_merged.lo build/fmpz_mod_vec_merged.lo build/fmpz_mod_mat_merged.lo build/fmpz_mod_poly_merged.lo build/fmpq_merged.lo build/fmpq_vec_merged.lo build/fmpq_mat_merged.lo build/fmpq_poly_merged.lo build/fq_merged.lo build/fq_vec_merged.lo build/fq_mat_merged.lo build/fq_poly_merged.lo build/fq_nmod_merged.lo build/fq_nmod_vec_merged.lo build/fq_nmod_mat_merged.lo build/fq_nmod_poly_merged.lo build/fq_zech_merged.lo build/fq_zech_mat_merged.lo build/fq_zech_poly_merged.lo build/fq_default_merged.lo build/fq_default_mat_merged.lo build/fq_default_poly_merged.lo build/fq_embed_merged.lo build/fq_nmod_embed_merged.lo build/fq_zech_embed_merged.lo build/padic_merged.lo build/padic_mat_merged.lo build/padic_poly_merged.lo build/qadic_merged.lo build/nmod_poly_factor_merged.lo build/fmpz_factor_merged.lo build/fmpz_poly_factor_merged.lo build/fmpz_mod_poly_factor_merged.lo build/fq_poly_factor_merged.lo build/fq_nmod_poly_factor_merged.lo build/fq_zech_poly_factor_merged.lo build/fq_default_poly_factor_merged.lo build/nmod_poly_mat_merged.lo build/fmpz_poly_mat_merged.lo build/mpoly_merged.lo build/nmod_mpoly_merged.lo build/fmpz_mpoly_merged.lo build/fmpz_mod_mpoly_merged.lo build/fmpq_mpoly_merged.lo build/fq_nmod_mpoly_merged.lo build/fq_zech_mpoly_merged.lo build/nmod_mpoly_factor_merged.lo build/fmpz_mpoly_factor_merged.lo build/fmpz_mod_mpoly_factor_merged.lo"
# Everything until fmpz_mod_mpoly_factor
# NOTE: Ubuntu 22.04's GCC 11 does not support -Wdangling-pointer

steps:
- uses: actions/checkout@v4

- name: "Setup"
run: |
sudo apt-get install -y libgmp-dev libmpfr-dev autoconf libtool-bin
gcc --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV

- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
CFLAGS="${CFLAGS}" \
--disable-debug

- name: "Check regression in a subset of modules"
run: |
$MAKE $MODULES



##############################################################################
# gcc build check no missing declarations
##############################################################################
gcc-missing-declarations-check:
name: GCC check for missing declarations

runs-on: ubuntu-latest

env:
CC: "gcc"
CFLAGS: "-march=native -std=c11 -Wall -Wextra -Wmissing-prototypes -Werror"
MODULES: "build/thread_pool_merged.lo build/thread_support_merged.lo build/ulong_extras_merged.lo build/long_extras_merged.lo build/perm_merged.lo build/double_extras_merged.lo build/d_vec_merged.lo build/d_mat_merged.lo build/mpn_extras_merged.lo build/mpfr_vec_merged.lo build/mpfr_mat_merged.lo build/nmod_merged.lo build/nmod_vec_merged.lo build/nmod_mat_merged.lo build/nmod_poly_merged.lo build/mpn_mod_merged.lo build/fmpz_merged.lo build/fmpz_vec_merged.lo build/fmpz_mat_merged.lo build/fmpz_poly_merged.lo build/fmpz_mod_merged.lo build/fmpz_mod_vec_merged.lo build/fmpz_mod_mat_merged.lo build/fmpz_mod_poly_merged.lo build/fmpq_merged.lo build/fmpq_vec_merged.lo build/fmpq_mat_merged.lo build/fmpq_poly_merged.lo build/fq_merged.lo build/fq_vec_merged.lo build/fq_mat_merged.lo build/fq_poly_merged.lo build/fq_nmod_merged.lo build/fq_nmod_vec_merged.lo build/fq_nmod_mat_merged.lo build/fq_nmod_poly_merged.lo build/fq_zech_merged.lo build/fq_zech_mat_merged.lo build/fq_zech_poly_merged.lo build/fq_default_merged.lo build/fq_default_mat_merged.lo build/fq_default_poly_merged.lo build/fq_embed_merged.lo build/fq_nmod_embed_merged.lo build/fq_zech_embed_merged.lo build/padic_merged.lo build/padic_mat_merged.lo build/padic_poly_merged.lo build/qadic_merged.lo"
# Everything until poly_factor stuff

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 9 additions & 1 deletion src/d_mat/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@

#define D_MAT_INLINES_C

#include "flint.h"
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "d_mat.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
10 changes: 9 additions & 1 deletion src/d_vec/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@

#define D_VEC_INLINES_C

#include "flint.h"
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "d_vec.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
10 changes: 9 additions & 1 deletion src/double_extras/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@

#define DOUBLE_EXTRAS_INLINES_C

#include "flint.h"
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "double_extras.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
12 changes: 9 additions & 3 deletions src/fmpq/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@

#define FMPQ_INLINES_C

#include "flint.h"
#include "ulong_extras.h"
#include "fmpz.h"
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "fmpq.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif

void fmpq_numerator(fmpz_t n, const fmpq_t q)
{
fmpz_set(n, fmpq_numref(q));
Expand Down
6 changes: 3 additions & 3 deletions src/fmpq/reconstruct_fmpz_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static int coprime_uiui(mp_limb_t u1, mp_limb_t u0, mp_limb_t v1, mp_limb_t v0)
}


int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d,
static int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d,
const fmpz_t a, const fmpz_t m, const fmpz_t NN, const fmpz_t DD)
{
mp_limb_t Q, R, A, B, N;
Expand Down Expand Up @@ -307,7 +307,7 @@ int _fmpq_reconstruct_fmpz_2_ui(fmpz_t n, fmpz_t d,
return 0;
}

int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d,
static int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d,
const fmpz_t a, const fmpz_t m, const fmpz_t NN, const fmpz_t DD)
{
mp_limb_t extra;
Expand Down Expand Up @@ -379,7 +379,7 @@ int _fmpq_reconstruct_fmpz_2_uiui(fmpz_t n, fmpz_t d,
return 0;
}

int _fmpq_reconstruct_fmpz_2_ui_array(fmpz_t n, fmpz_t d,
static int _fmpq_reconstruct_fmpz_2_ui_array(fmpz_t n, fmpz_t d,
const fmpz_t a, const fmpz_t m, const fmpz_t N, const fmpz_t D)
{
mp_limb_t ex0, ex1, ex2, ex3, A1, A0, B1, B0;
Expand Down
4 changes: 1 addition & 3 deletions src/fmpq/set_cfrac.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#include "fmpq.h"


void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n)
static void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n)
{
_fmpz_mat22_one(M);
if (n < 32)
Expand All @@ -33,7 +32,6 @@ void _fmpq_set_cfrac_divconquer(_fmpz_mat22_t M, const fmpz * c, slong n)
}
}


void fmpq_set_cfrac(fmpq_t x, const fmpz * c, slong n)
{
_fmpz_mat22_t M;
Expand Down
13 changes: 11 additions & 2 deletions src/fmpq_mat/can_solve_multi_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
#include "fmpz_mat.h"
#include "fmpq_mat.h"

static int
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

int
_fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B)
{
slong i, j;
Expand Down Expand Up @@ -55,6 +60,10 @@ _fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const
return ok;
}

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif

static int
_permpiv_cmp(slong * perm, slong * prm, slong * pivots, slong * piv, slong n)
{
Expand Down Expand Up @@ -84,7 +93,7 @@ _permpiv_copy(slong * perm, slong * prm, slong * pivots, slong * piv, slong n)
}
}

int
static int
_fmpq_mat_can_solve_multi_mod(fmpq_mat_t X,
const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t D)
{
Expand Down
2 changes: 1 addition & 1 deletion src/fmpq_mat/get_fmpz_mat_rowwise.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "fmpz_mat.h"
#include "fmpq_mat.h"

void
static void
_fmpq_mat_get_fmpz_mat_rowwise(fmpz_mat_struct ** num, fmpz * den,
const fmpq_mat_struct ** mat, slong n)
{
Expand Down
9 changes: 9 additions & 0 deletions src/fmpq_mat/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@

#define FMPQ_MAT_INLINES_C

#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "fmpq_mat.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
2 changes: 1 addition & 1 deletion src/fmpq_mat/solve_dixon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int
_fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B);


void
static void
_fmpq_mat_solve_dixon(fmpq_mat_t X,
const fmpz_mat_t A, const fmpz_mat_t B,
const nmod_mat_t Ainv, mp_limb_t p,
Expand Down
63 changes: 28 additions & 35 deletions src/fmpq_mat/solve_multi_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,43 @@
#include "fmpz_mat.h"
#include "fmpq_mat.h"

mp_limb_t fmpz_mat_find_good_prime_and_solve(nmod_mat_t Xmod,
nmod_mat_t Amod, nmod_mat_t Bmod,
const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound);
static mp_limb_t fmpz_mat_find_good_prime_and_solve(
nmod_mat_t Xmod, nmod_mat_t Amod, nmod_mat_t Bmod,
const fmpz_mat_t A, const fmpz_mat_t B, const fmpz_t det_bound)
{
mp_limb_t p;
fmpz_t tested;

p = UWORD(1) << NMOD_MAT_OPTIMAL_MODULUS_BITS;
fmpz_init(tested);
fmpz_one(tested);

int
_fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B)
{
slong i, j;
fmpz_mat_t Xclear, AXclear;
fmpz_t t;
fmpz * Xden;
int ok;

Xden = _fmpz_vec_init(X->c);
fmpz_mat_init(Xclear, X->r, X->c);
fmpz_mat_init(AXclear, B->r, B->c);
fmpz_init(t);

fmpq_mat_get_fmpz_mat_colwise(Xclear, Xden, X);
fmpz_mat_mul(AXclear, A, Xclear);

ok = 1;
for (i = 0; i < B->r && ok; i++)
while (1)
{
for (j = 0; j < B->c && ok; j++)
p = n_nextprime(p, 0);
nmod_mat_set_mod(Xmod, p);
nmod_mat_set_mod(Amod, p);
nmod_mat_set_mod(Bmod, p);
fmpz_mat_get_nmod_mat(Amod, A);
fmpz_mat_get_nmod_mat(Bmod, B);
if (nmod_mat_solve(Xmod, Amod, Bmod))
break;
fmpz_mul_ui(tested, tested, p);
if (fmpz_cmp(tested, det_bound) > 0)
{
/* AXclear[i,j] / Xden[j] = B[i,j] */
fmpz_mul(t, fmpz_mat_entry(B, i, j), Xden + j);

if (!fmpz_equal(t, fmpz_mat_entry(AXclear, i, j)))
ok = 0;
p = 0;
break;
}
}

_fmpz_vec_clear(Xden, X->c);
fmpz_mat_clear(Xclear);
fmpz_mat_clear(AXclear);
fmpz_clear(t);

return ok;
fmpz_clear(tested);
return p;
}

void
int
_fmpq_mat_check_solution_fmpz_mat(const fmpq_mat_t X, const fmpz_mat_t A, const fmpz_mat_t B);

static void
_fmpq_mat_solve_multi_mod(fmpq_mat_t X,
const fmpz_mat_t A, const fmpz_mat_t B,
nmod_mat_t Xmod, nmod_mat_t Amod, nmod_mat_t Bmod,
Expand Down
4 changes: 2 additions & 2 deletions src/fmpq_poly/cos_series.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void
_fmpq_poly_sin_cos_series_basecase_can(fmpz * S, fmpz_t Sden,
fmpz * C, fmpz_t Cden, const fmpz * A, const fmpz_t Aden, slong Alen, slong n, int can);

void
static void
_fmpq_poly_cos_series_basecase(fmpz * g, fmpz_t gden,
const fmpz * h, const fmpz_t hden, slong hlen, slong n)
{
Expand All @@ -36,7 +36,7 @@ _fmpq_poly_cos_series_basecase(fmpz * g, fmpz_t gden,
_fmpz_vec_clear(tmp, n + 1);
}

void
static void
_fmpq_poly_cos_series_tangent(fmpz * g, fmpz_t gden,
const fmpz * h, const fmpz_t hden, slong hlen, slong n)
{
Expand Down
8 changes: 4 additions & 4 deletions src/fmpq_poly/exp_series.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static ulong _fmpz_gcd_small(const fmpz_t g, ulong h)
/* Basecase algorithm, given a precomputed derivative of
of the input series (Alen still refers to the length
of the original series). */
void
static void
_fmpq_poly_exp_series_basecase_deriv(fmpz * B, fmpz_t Bden,
const fmpz * Aprime, const fmpz_t Aden, slong Alen, slong n)
{
Expand Down Expand Up @@ -68,7 +68,7 @@ _fmpq_poly_exp_series_basecase_deriv(fmpz * B, fmpz_t Bden,
}

/* Basecase algorithm; supports aliasing and guarantees canonical output. */
void
static void
_fmpq_poly_exp_series_basecase(fmpz * B, fmpz_t Bden,
const fmpz * A, const fmpz_t Aden, slong Alen, slong n)
{
Expand Down Expand Up @@ -98,7 +98,7 @@ _fmpq_poly_exp_series_basecase(fmpz * B, fmpz_t Bden,
}

/* c_k x^k -> c_k x^k / (m+k) */
void _fmpq_poly_integral_offset(fmpz * rpoly, fmpz_t rden,
static void _fmpq_poly_integral_offset(fmpz * rpoly, fmpz_t rden,
const fmpz * poly, const fmpz_t den, slong len, slong m)
{
slong k;
Expand Down Expand Up @@ -234,7 +234,7 @@ CONCATENATE(fmpz * poly, fmpz_t den, const fmpz_t high_den, slong m, slong n)
/* Newton iteration. If g == NULL, computes {f, fden, n} = exp({h, hden, hlen}).
If g != NULL, simultaneously computes {g, gden, n} = exp(-{h, hden, hlen}).
Allows aliasing between (f, fden) and (h, hden) but not with (g, gden). */
void
static void
_fmpq_poly_exp_series_newton(fmpz * f, fmpz_t fden,
fmpz * g, fmpz * gden,
const fmpz * h, const fmpz_t hden,
Expand Down
9 changes: 9 additions & 0 deletions src/fmpq_poly/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@

#define FMPQ_POLY_INLINES_C

#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#include "fmpq_poly.h"

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
Loading