Skip to content

Commit

Permalink
Merge pull request #1873 from albinahlback/warnings
Browse files Browse the repository at this point in the history
Warnings
  • Loading branch information
albinahlback authored Mar 22, 2024
2 parents 2843ebb + 58f9f08 commit be999aa
Show file tree
Hide file tree
Showing 187 changed files with 543 additions and 421 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,47 @@ jobs:



##############################################################################
# gcc build check no regressions
##############################################################################
gcc-build-regression-check:
name: GCC build regression check (no tests)

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/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"
# Everything until finite fields

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-static \
--disable-debug
- name: "Check regression in a subset of modules"
run: |
$MAKE $MODULES
##############################################################################
# ubuntu gcc with assert
##############################################################################
Expand Down
8 changes: 5 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,11 @@ fi
# check libraries
################################################################################

# With certain CFLAGS, the compiler may return an error, thinking that the
# compiler has not found the function in the library.
save_CFLAGS="$CFLAGS"
CFLAGS=""

AC_SEARCH_LIBS([atan2],[m],
[],
[AC_MSG_ERROR(["The C math library was not found!"])])
Expand Down Expand Up @@ -1142,9 +1147,6 @@ AC_CHECK_FUNCS([aligned_alloc _aligned_malloc])
# CFLAGS
################################################################################

save_CFLAGS="$CFLAGS"
CFLAGS=""

# The following is needed for Clang to check for unknown options.
FLINT_CLANG([AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],
[CFLAGS="-Werror=unknown-warning-option"])])
Expand Down
6 changes: 3 additions & 3 deletions doc/source/nmod_poly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2390,18 +2390,18 @@ Inflation and deflation
--------------------------------------------------------------------------------


.. function:: void nmod_poly_inflate(nmod_poly_t result, const nmod_poly_t input, ulong inflation)
.. function:: void nmod_poly_inflate(nmod_poly_t result, const nmod_poly_t input, slong inflation)

Sets ``result`` to the inflated polynomial `p(x^n)` where
`p` is given by ``input`` and `n` is given by ``deflation``.

.. function:: void nmod_poly_deflate(nmod_poly_t result, const nmod_poly_t input, ulong deflation)
.. function:: void nmod_poly_deflate(nmod_poly_t result, const nmod_poly_t input, slong deflation)

Sets ``result`` to the deflated polynomial `p(x^{1/n})` where
`p` is given by ``input`` and `n` is given by ``deflation``.
Requires `n > 0`.

.. function:: ulong nmod_poly_deflation(const nmod_poly_t input)
.. function:: slong nmod_poly_deflation(const nmod_poly_t input)

Returns the largest integer by which ``input`` can be deflated.
As special cases, returns 0 if ``input`` is the zero polynomial
Expand Down
2 changes: 1 addition & 1 deletion src/d_vec/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
void
_d_vec_add(double *res, const double *vec1, const double *vec2, slong len2)
{
ulong i;
slong i;
for (i = 0; i < len2; i++)
res[i] = vec1[i] + vec2[i];
}
2 changes: 1 addition & 1 deletion src/d_vec/sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
void
_d_vec_sub(double *res, const double *vec1, const double *vec2, slong len2)
{
ulong i;
slong i;
for (i = 0; i < len2; i++)
res[i] = vec1[i] - vec2[i];
}
1 change: 1 addition & 0 deletions src/fexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" {
#endif

#include "mpoly_types.h"
#include "mpn_extras.h"
#include "calcium.h"

#define FEXPR_TYPE_SMALL_INT UWORD(0)
Expand Down
1 change: 1 addition & 0 deletions src/fft/adjust.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void fft_adjust(mp_limb_t * r, mp_limb_t * i1, mp_size_t i, mp_size_t limbs, flint_bitcnt_t w)
Expand Down
1 change: 1 addition & 0 deletions src/fft/adjust_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void fft_adjust_sqrt2(mp_limb_t * r, mp_limb_t * i1,
Expand Down
1 change: 1 addition & 0 deletions src/fft/div_2expmod_2expp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

/* WARNING: relies on GCC's handling of >> as arithmetic shift right */
Expand Down
1 change: 1 addition & 0 deletions src/fft/fermat_to_mpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void fermat_to_mpz(mpz_t m, mp_limb_t * i, mp_size_t limbs)
Expand Down
1 change: 1 addition & 0 deletions src/fft/fft_truncate_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void fft_butterfly_sqrt2(mp_limb_t * s, mp_limb_t * t,
Expand Down
1 change: 1 addition & 0 deletions src/fft/ifft_truncate_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void ifft_butterfly_sqrt2(mp_limb_t * s, mp_limb_t * t, mp_limb_t * i1,
Expand Down
1 change: 1 addition & 0 deletions src/fft/mul_2expmod_2expp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

/* WARNING: relies on GCC's handling of >> as arithmetic shift right */
Expand Down
1 change: 1 addition & 0 deletions src/fft/mul_mfa_truncate_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

void mul_mfa_truncate_sqrt2(mp_ptr r1, mp_srcptr i1, mp_size_t n1,
Expand Down
1 change: 1 addition & 0 deletions src/fft/negmod_2expp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fft.h"

/* negation mod 2^(FLINT_BITS*limbs) + 1 assuming normalized input */
Expand Down
1 change: 1 addition & 0 deletions src/fft/split_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "thread_pool.h"
#include "thread_support.h"
#include "fft.h"
Expand Down
6 changes: 4 additions & 2 deletions src/fft_small.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ void sd_fft_ctx_init_prime(sd_fft_ctx_t Q, ulong pp);
void sd_fft_ctx_fit_depth(sd_fft_ctx_t Q, ulong k);

/* TODO: these should probably increment/decrement a ref count */
FLINT_FORCE_INLINE void sd_fft_lctx_init(sd_fft_lctx_t L, sd_fft_ctx_t Q, ulong depth)
FLINT_FORCE_INLINE
void sd_fft_lctx_init(sd_fft_lctx_t L, sd_fft_ctx_t Q, ulong depth)
{
L->p = Q->p;
L->pinv = Q->pinv;
Expand All @@ -263,7 +264,8 @@ FLINT_FORCE_INLINE void sd_fft_lctx_init(sd_fft_lctx_t L, sd_fft_ctx_t Q, ulong
L->w2tab[i] = Q->w2tab[i];
}

FLINT_FORCE_INLINE void sd_fft_lctx_clear(sd_fft_lctx_t LQ, sd_fft_ctx_t Q)
FLINT_FORCE_INLINE
void sd_fft_lctx_clear(sd_fft_lctx_t FLINT_UNUSED(LQ), sd_fft_ctx_t FLINT_UNUSED(Q))
{
}

Expand Down
1 change: 1 addition & 0 deletions src/fft_small/fmpz_poly_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "thread_pool.h"
#include "thread_support.h"
#include "nmod.h"
Expand Down
1 change: 1 addition & 0 deletions src/fft_small/mpn_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <stdint.h>
#include <string.h>
#include "mpn_extras.h"
#include "thread_pool.h"
#include "thread_support.h"
#include "nmod.h"
Expand Down
40 changes: 7 additions & 33 deletions src/flint.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ typedef struct __FLINT_FILE FLINT_FILE;
#if defined(__GNUC__)
# define FLINT_FORCE_INLINE static __attribute__((always_inline)) inline
# define FLINT_STATIC_NOINLINE static __attribute__((noinline))
# define FLINT_UNUSED(x) UNUSED_ ## x __attribute__((unused))
# if !FLINT_WANT_ASSERT
# define FLINT_UNUSED(x) UNUSED_ ## x __attribute__((unused))
# else
/* NOTE: This may or may not be required as some function inputs may be used
* for assertions. */
# define FLINT_UNUSED(x) x
# endif
# define FLINT_SET_BUT_UNUSED(x) x __attribute__((unused))
# define FLINT_CONST __attribute__ ((const))
# define FLINT_WARN_UNUSED __attribute__((warn_unused_result))
Expand Down Expand Up @@ -373,38 +379,6 @@ mp_limb_t FLINT_BIT_COUNT(mp_limb_t x)

#define FLINT_CLOG2(k) FLINT_BIT_COUNT((k) - 1)

/* mpn macros ****************************************************************/

#define flint_mpn_zero(xxx, nnn) \
do \
{ \
slong ixxx; \
for (ixxx = 0; ixxx < (nnn); ixxx++) \
(xxx)[ixxx] = UWORD(0); \
} while (0)

#define flint_mpn_copyi(xxx, yyy, nnn) \
do { \
slong ixxx; \
for (ixxx = 0; ixxx < (nnn); ixxx++) \
(xxx)[ixxx] = (yyy)[ixxx]; \
} while (0)

#define flint_mpn_copyd(xxx, yyy, nnn) \
do { \
slong ixxx; \
for (ixxx = nnn - 1; ixxx >= 0; ixxx--) \
(xxx)[ixxx] = (yyy)[ixxx]; \
} while (0)

#define flint_mpn_store(xxx, nnn, yyy) \
do \
{ \
slong ixxx; \
for (ixxx = 0; ixxx < nnn; ixxx++) \
(xxx)[ixxx] = yyy; \
} while (0)

/* allocation macros *********************************************************/

#define FLINT_ARRAY_ALLOC(n, T) (T *) flint_malloc((n)*sizeof(T))
Expand Down
1 change: 1 addition & 0 deletions src/fmpq/fmpz_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "mpn_extras.h"
#include "fmpq.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion src/fmpq/get_cfrac_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ static void _lehmer_exact(_fmpq_cfrac_list_t s, _fmpz_mat22_t M, int flags,
if (n < 3)
goto cleanup;

if ((flags & CFRAC_NEED_HGCD) && xd_len <= 3 + _fmpz_mat22_bits(M)/FLINT_BITS)
if ((flags & CFRAC_NEED_HGCD) && xd_len <= 3 + (slong) (_fmpz_mat22_bits(M) / FLINT_BITS))
{
goto cleanup;
}
Expand Down
8 changes: 4 additions & 4 deletions src/fmpq/harmonic_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "fmpq.h"

#if FLINT_BITS == 64
#define FMPQ_HARMONIC_UI_TAB_SIZE 47
# define FMPQ_HARMONIC_UI_TAB_SIZE 47
#else
#define FMPQ_HARMONIC_UI_TAB_SIZE 25
# define FMPQ_HARMONIC_UI_TAB_SIZE 25
#endif

static const mp_limb_t fmpq_harmonic_ui_tab_num[] =
Expand Down Expand Up @@ -118,7 +118,7 @@ harmonic_odd_direct(fmpz_t P, fmpz_t Q, ulong a, ulong b, ulong n, int d)
{
for (k = b - 1 - (b % 2); k > 0; k -= 2)
{
while (k <= (n >> d))
while ((ulong) k <= (n >> d))
d++;

r = (UWORD(1) << d) - UWORD(1);
Expand Down Expand Up @@ -162,7 +162,7 @@ harmonic_odd_direct(fmpz_t P, fmpz_t Q, ulong a, ulong b, ulong n, int d)
{
a += (a % 2 == 0);

for (k = a; k < b; k += 2)
for (k = a; (ulong) k < b; k += 2)
{
umul_ppmm(t, u, p, k);
v = 0;
Expand Down
13 changes: 5 additions & 8 deletions src/fmpq_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void fmpq_poly_shift_right(fmpq_poly_t res, const fmpq_poly_t poly, slong n);
#ifdef FMPZ_H
void _fmpq_poly_divrem(fmpz * Q, fmpz_t q, fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv);
void _fmpq_poly_div(fmpz * Q, fmpz_t q, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv);
void _fmpq_poly_rem(fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t b, slong lenB, const fmpz_preinvn_t inv);
void _fmpq_poly_rem(fmpz * R, fmpz_t r, const fmpz * A, const fmpz_t a, slong lenA, const fmpz * B, const fmpz_t FLINT_UNUSED(b), slong lenB, const fmpz_preinvn_t inv);
#endif

void fmpq_poly_divrem(fmpq_poly_t Q, fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t poly2);
Expand All @@ -379,11 +379,8 @@ void fmpq_poly_rem(fmpq_poly_t R, const fmpq_poly_t poly1, const fmpq_poly_t pol

/* Precomputed inverse *****************************************************/

fmpq_poly_struct * _fmpq_poly_powers_precompute(const fmpz * B,
const fmpz_t denB, slong len);

void fmpq_poly_powers_precompute(fmpq_poly_powers_precomp_t pinv,
fmpq_poly_t poly);
fmpq_poly_struct * _fmpq_poly_powers_precompute(const fmpz * B, const fmpz_t FLINT_UNUSED(denB), slong len);
void fmpq_poly_powers_precompute(fmpq_poly_powers_precomp_t pinv, fmpq_poly_t poly);

void _fmpq_poly_powers_clear(fmpq_poly_struct * powers, slong len);

Expand Down Expand Up @@ -697,7 +694,7 @@ void _fmpq_poly_content(fmpq_t res,
void fmpq_poly_content(fmpq_t res, const fmpq_poly_t poly);

void _fmpq_poly_primitive_part(fmpz * rpoly, fmpz_t rden,
const fmpz * poly, const fmpz_t den, slong len);
const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len);

void fmpq_poly_primitive_part(fmpq_poly_t res, const fmpq_poly_t poly);

Expand All @@ -706,7 +703,7 @@ int _fmpq_poly_is_monic(const fmpz * poly, const fmpz_t den, slong len);
int fmpq_poly_is_monic(const fmpq_poly_t poly);

void _fmpq_poly_make_monic(fmpz * rpoly, fmpz_t rden,
const fmpz * poly, const fmpz_t den, slong len);
const fmpz * poly, const fmpz_t FLINT_UNUSED(den), slong len);

void fmpq_poly_make_monic(fmpq_poly_t res, const fmpq_poly_t poly);

Expand Down
Loading

0 comments on commit be999aa

Please sign in to comment.