Missing declarations runner
Currently we have functions that are declared as global functions, but miss declarations in headers. Now, some may be missed in headers, other should be converted to static functions. Compiling with -Wmissing-prototypes shows which ones it is.
Doing this can show which ones should actually be local/static and which ones may miss a declaration in a header. On the other hand, if a helper function defined as a global function is no longer used, but still defined, it will still be compiled and take up space in the binary and in the source code. Hence, we should aim to cover the whole library with this compiler flag (will probably take years to fix this, thought).
Some files are problematic, such as inlines.c, but an easy guard with
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
#include "footer.h"
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
fixes this
I think it is necessary to be able to sanitize the FLINT source code, but I'll wait a day or so before merging this in case someone has any objections.
Your proposed sanitization sounds good to me.
On Fri, Apr 12, 2024, 19:39 Albin Ahlbäck @.***> wrote:
Currently we have functions that are declared as global functions, but miss declarations in headers. Now, some may be missed in headers, other should be converted to static functions. Compiling with -Wmissing-prototypes shows which ones it is.
Doing this can show which ones should actually be local/static and which ones may miss a declaration in a header. On the other hand, if a helper function defined as a global function is no longer used, but still defined, it will still be compiled and take up space in the binary and in the source code. Hence, we should aim to cover the whole library with this compiler flag (will probably take years, thought).
Some files are problematic, such as inlines.c, but an easy guard with
#if defined(GNUC)# pragma GCC diagnostic push# pragma GCC diagnostic ignored "-Wmissing-declarations"#endif #include "footer.h" #if defined(GNUC)# pragma GCC diagnostic pop#endif
I think it is necessary to be able to sanitize the FLINT source code, but I'll wait a day or so before merging this in case someone has any objections.
You can view, comment on, or merge this pull request online at:
https://github.com/flintlib/flint/pull/1921 Commit Summary
- 725cf16 https://github.com/flintlib/flint/pull/1921/commits/725cf16a77b5789f2fc7af71955538f103029120 Enable compiling nmod_mpoly_factor with -Wextra
- b730fd0 https://github.com/flintlib/flint/pull/1921/commits/b730fd0db06aebebebea97a80a2e29e539b88474 Enable compiling fmpz_mpoly_factor with -Wextra
- 260ba8c https://github.com/flintlib/flint/pull/1921/commits/260ba8cd25067c9528232e8ad00cbb3aea9afb36 Start fixing warnings about missing declarations
- d7a8ed8 https://github.com/flintlib/flint/pull/1921/commits/d7a8ed8ffea0afe36dbdd20327c3a2fefc73e928 Add CI for checking for missing declarations
- dff103f https://github.com/flintlib/flint/pull/1921/commits/dff103f4aa779924107b77831ac48283177f1bf0 Update regression runner
File Changes
(68 files https://github.com/flintlib/flint/pull/1921/files)
- M .github/workflows/CI.yml https://github.com/flintlib/flint/pull/1921/files#diff-3ab46ee209a127470fce3c2cf106b1a1dbadbb929a4b5b13656a4bc4ce19c0b8 (46)
- M src/d_mat/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-9230eb41ffc71cceae2b103e288be8d5ed57c8cf6f0a8434405fbaa271701527 (10)
- M src/d_vec/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-abd2226481f74b88eaf07164fa2fe591c08c0e612ad0b6d8f23b7f29802c19fb (10)
- M src/double_extras/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-f184f5ef3b3195adf66a99a57b1d28067422dbae964912bc7abb742ba8926623 (10)
- M src/fmpz/CRT.c https://github.com/flintlib/flint/pull/1921/files#diff-8bbd142a1021fc4c9b64390f9be3fde6d789b437a61ac170857e315c26a722a5 (2)
- M src/fmpz/addmul.c https://github.com/flintlib/flint/pull/1921/files#diff-90db53756136a3d4f44bd0dca6e384802d1d3963d9bc44aa91151872126a457e (2)
- M src/fmpz/fdiv.c https://github.com/flintlib/flint/pull/1921/files#diff-13f6b457eab74ad37893501865517edaf8851462b92f8621addebed3ff2a328f (4)
- M src/fmpz/get_str.c https://github.com/flintlib/flint/pull/1921/files#diff-47a9e89b84f92269718b3070f72a72fca802733c5f99904c62e0917d663a4569 (2)
- M src/fmpz/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-5ffa986412afc85a763e15e02f3ab97febe586ef5a2e94b3d371bd7affeeb34c (9)
- M src/fmpz/invmod.c https://github.com/flintlib/flint/pull/1921/files#diff-64debac285a4f05f0f860781f366acac43732cc8dcee38c9e0672064eda92272 (3)
- M src/fmpz/is_prime.c https://github.com/flintlib/flint/pull/1921/files#diff-3ff628f925904f8ceef15e90a66def98b049f692e6eedc4e8d9403b5d3294642 (2)
- M src/fmpz/is_prime_pseudosquare.c https://github.com/flintlib/flint/pull/1921/files#diff-79830abe697c76cbf4b2b31502def06d4a9d78b6f97c332ec87c5c7237e1f8ac (4)
- M src/fmpz/link/fmpz_gc.c https://github.com/flintlib/flint/pull/1921/files#diff-4c0dee4bfeadfb332da248c7e9cac58303405752058dfd3debfc6a35a0cffb54 (2)
- M src/fmpz/link/fmpz_single.c https://github.com/flintlib/flint/pull/1921/files#diff-346f68c42bfa7c6efd2774bb4962b7dfb6ae6ca07a3dad23cafc8a89609a7bd4 (2)
- M src/fmpz/primorial.c https://github.com/flintlib/flint/pull/1921/files#diff-d328c8774c78ef4449ff0ae76921b0efbac831bf3cf6b55686f0c971e648ab42 (8)
- M src/fmpz/set_str.c https://github.com/flintlib/flint/pull/1921/files#diff-c4be931b8bc444437adfa06e42fa4514e21cb9a4bf3f95a38034cb451580f8b8 (2)
- M src/fmpz_mpoly.h https://github.com/flintlib/flint/pull/1921/files#diff-254546365ffe8df629271a85778ba5cf1eb217bfe21a2655ccf567930daf3bac (4)
- M src/fmpz_mpoly_factor.h https://github.com/flintlib/flint/pull/1921/files#diff-8f89a635e975ba81a3cd965a007282dae7e2c51034b091dfca412287b55ef5fa (16)
- M src/fmpz_mpoly_factor/bpoly_factor.c https://github.com/flintlib/flint/pull/1921/files#diff-58cc0abce969b41dca10c8b61439caec660a96babfa1d02bf8921fe28dcc903c (39)
- M src/fmpz_mpoly_factor/eval.c https://github.com/flintlib/flint/pull/1921/files#diff-c9bf20bd0ff4debbb2dc632678888f05841bcb6682bb392367c297dabf4f4ed6 (2)
- M src/fmpz_mpoly_factor/gcd_algo.c https://github.com/flintlib/flint/pull/1921/files#diff-bf399243fd9ec29637143a55be759b3bd3ae9c219ca40e992797d128353e2437 (2)
- M src/fmpz_mpoly_factor/gcd_brown.c https://github.com/flintlib/flint/pull/1921/files#diff-0f60925ea738f4f24c4e08b8f095ab820216550cbfc9becadccd1c59e6f02219 (4)
- M src/fmpz_mpoly_factor/gcd_zippel.c https://github.com/flintlib/flint/pull/1921/files#diff-541396359c67970f866b58ce05aad3cd3a1bc18330270b2478238a1acce43ab6 (4)
- M src/fmpz_mpoly_factor/gcd_zippel2.c https://github.com/flintlib/flint/pull/1921/files#diff-3f4e0e6a02cc90c6a67516fe54cd07366d923b1a1d88d36fcb574bb654330ea6 (26)
- M src/fmpz_mpoly_factor/interp.c https://github.com/flintlib/flint/pull/1921/files#diff-0665a3fbf0cd56a186dfad59d243053f6a046c280176d790208626bb44633405 (2)
- M src/fmpz_mpoly_factor/irred_zassenhaus.c https://github.com/flintlib/flint/pull/1921/files#diff-a24351f0ed9ce8abdf0d7e34a107fb5c46821f25f6edd12f152ae6adcb3ea0c6 (4)
- M src/fmpz_mpoly_factor/irred_zippel.c https://github.com/flintlib/flint/pull/1921/files#diff-5247527191fef91976182b7f23286bca1184cfd931a540924f41fe1d4d3050fb (8)
- M src/fmpz_mpoly_factor/misc.c https://github.com/flintlib/flint/pull/1921/files#diff-77abc7224568a914cd32fda7ef948f32d534f6ac9f90d3b1aa7bcbc0211f3062 (12)
- M src/fmpz_vec/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-fd991ed158696a608ad60ac49285444662ab3dd1fd0efdc0dfe02942e8334539 (10)
- M src/generic_files/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-1209a2038f97002f6eb34e641ca4e825d923a9788a129690752a168fd3ed581d (9)
- M src/generic_files/memory_manager.c https://github.com/flintlib/flint/pull/1921/files#diff-d6469b86dadfea67761d0dc63a097f2cdd1aab67ef9dd6976f78ba95ba0e384a (2)
- M src/long_extras/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-9b4fa704f6910d54930d41732f8df338bda1ce977d5f261b552217d3d8c44a0e (10)
- M src/mpn_extras/factor_trial_tree.c https://github.com/flintlib/flint/pull/1921/files#diff-b4d5dca5236c19af162661d2ec638b4dc6f80f5e943bf99286ff098780d81059 (4)
- M src/mpn_extras/get_d.c https://github.com/flintlib/flint/pull/1921/files#diff-aeac6c8ac985341701ea8c701f7855123ea74ac2afbdf1737f38fd796201fbfe (2)
- M src/mpn_extras/mul_basecase.c https://github.com/flintlib/flint/pull/1921/files#diff-d10e45b91175e60b13e22681555fb22ede3ab410f7d31ba1305ad95a050c0b4b (9)
- M src/mpn_extras/sqr_basecase.c https://github.com/flintlib/flint/pull/1921/files#diff-2eb85bf72b13ce296e30fb1ac4a08c06dec24285a59d869418921c68db80bdb7 (9)
- M src/mpn_mod/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-6ef30e3a1a31373db213de61100c2d923e3b8d24c7110f557ba228e58829059a (9)
- M src/mpn_mod/poly_mullow_fft_small.c https://github.com/flintlib/flint/pull/1921/files#diff-7e8cffa5202379f4bcf341e12d66a70d5f1c593da04a38f9422cca704b3755e4 (2)
- M src/mpn_mod/poly_mullow_karatsuba.c https://github.com/flintlib/flint/pull/1921/files#diff-cbb20f19f8d9c18b5293c327cb07f47dac97bda0420314707ff6502b57ef76f8 (14)
- M src/nmod/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-5c10974cabe3ce8ace4da3d249d3931fc782cb4985514ebb475f6c0084217aaf (10)
- M src/nmod_mat/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-d361bc9e16034740d65ed1453747cc0147bb4577d5e1b0a2cfb6b4e63fb588c5 (9)
- M src/nmod_mat/lu_classical_delayed.c https://github.com/flintlib/flint/pull/1921/files#diff-c5a3585ccce129aa0b97b333f1e18138398674f0597173f8b67240654d87d020 (6)
- M src/nmod_mat/mul_classical_threaded.c https://github.com/flintlib/flint/pull/1921/files#diff-52fb8f1ef1a9a4796c4b3ad0532898904a3ee44474361e19ed57513ed8434ed1 (6)
- M src/nmod_mpoly_factor.h https://github.com/flintlib/flint/pull/1921/files#diff-986378e9ca8aec0ee321931e4fe9e5d560a699b32c1eb55b9965d20771ab7928 (2)
- M src/nmod_mpoly_factor/eval.c https://github.com/flintlib/flint/pull/1921/files#diff-b292a5dd540b7fa493ad9c0c4c801eeb7c741714ca77b100bdb1d5cb9e79f215 (2)
- M src/nmod_mpoly_factor/gcd_zippel.c https://github.com/flintlib/flint/pull/1921/files#diff-a198de2cf6c1b5581fc8969a6b003b2c344e91b2989475995c60a21d914cf330 (16)
- M src/nmod_mpoly_factor/get_set.c https://github.com/flintlib/flint/pull/1921/files#diff-39c3ac4e6c68eac49fb1eef1991293576fad04df47a339eae1daafabac9a697a (2)
- M src/nmod_mpoly_factor/irred_smprime_zassenhaus.c https://github.com/flintlib/flint/pull/1921/files#diff-88f9c02d3f03206551ff8564f59a84fc4dee37167d659b30f500f02d5ea23e89 (2)
- M src/nmod_mpoly_factor/n_bpoly_mod_factor_lgprime.c https://github.com/flintlib/flint/pull/1921/files#diff-049ad5f6c9c661193907f8867e69cc8609a1e1f655fddf6ab77c3541c087fe4f (2)
- M src/nmod_mpoly_factor/n_bpoly_mod_factor_smprime.c https://github.com/flintlib/flint/pull/1921/files#diff-d5b10a86ea8ba1507edd737a76590407e9a63e9e80e421989d9ae4fcfb6badef (6)
- M src/nmod_poly/div_series.c https://github.com/flintlib/flint/pull/1921/files#diff-b73922f97d5c6a481b487370e1f5c5f9eaf692a17a2151937691f7ef5fc6f558 (2)
- M src/nmod_poly/divrem_basecase.c https://github.com/flintlib/flint/pull/1921/files#diff-48ddfcec64280961d70d398fa15c622819b88f85e6bc217102f4a9f522fe7eb2 (10)
- M src/nmod_poly/evaluate_mat.c https://github.com/flintlib/flint/pull/1921/files#diff-db13084348df8139df3ec843547f7f0e51d8f81a1d8ae3949fd63db838c355d5 (2)
- M src/nmod_poly/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-9d1fa14c6818ee228b5083e81236cef80a78830aa96204e4be7b6821d041903c (9)
- M src/nmod_poly/inv_series.c https://github.com/flintlib/flint/pull/1921/files#diff-5cccb1abd8b1082239ec21f7aeff1b0384bdd57f2f0d6a7e8c7c46e37b1fc72e (2)
- M src/nmod_poly/powers_mod.c https://github.com/flintlib/flint/pull/1921/files#diff-51ba58b5ef543746b62b7290619c3278c7b74dc953b88b849c1525594adc3234 (2)
- M src/nmod_poly/rem.c https://github.com/flintlib/flint/pull/1921/files#diff-fe644f237129d51a222f8165421993995ec66fa137aceac73f891815796eb17b (2)
- M src/nmod_vec/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-a5dc1f549f8dcb7aeabcf39d1957921a75e8a3e6864ad4c9651c50ae0bd0b76e (9)
- M src/nmod_vec/scalar.c https://github.com/flintlib/flint/pull/1921/files#diff-f416c565dee2be1604b757fc0cc16d46a10ddecfc23eaaddcadc62ecb4361e06 (10)
- M src/perm/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-8af9fba97c659126c1963df59d891defbdb6a8f7202f9947be9d2b2c8b31ffee (10)
- M src/thread_support/get_num_available_threads.c https://github.com/flintlib/flint/pull/1921/files#diff-86b5773840c03107c3ec19b2aeae4641cfb6c6d2de6814f328d5495d687a4675 (3)
- M src/ulong_extras/discrete_log_bsgs.c https://github.com/flintlib/flint/pull/1921/files#diff-2f060137d5711c1c3a813fe62dbe3096d04e716f437b85ba2465c4ee1007e853 (2)
- M src/ulong_extras/factor_SQUFOF.c https://github.com/flintlib/flint/pull/1921/files#diff-65a10a6f8a9dfe8932c153b8d9626e1c02fefb215311b890bcb92f58d0e5b744 (2)
- M src/ulong_extras/factor_partial.c https://github.com/flintlib/flint/pull/1921/files#diff-4e4f270fede2c2885b722e57eba715a0e948586438b7d5a64263abd757b5b9e9 (2)
- M src/ulong_extras/factor_pollard_brent.c https://github.com/flintlib/flint/pull/1921/files#diff-967f80e5c2ae6cbef5a4e4b5f86c01411508bc0d79e142cbaceae5ce6e29a9e0 (2)
- M src/ulong_extras/factor_pp1.c https://github.com/flintlib/flint/pull/1921/files#diff-5f9855c59b495d0316f0283fb6ae9c5f7ec593b18a5b78047ed1d525ed9e5fea (6)
- M src/ulong_extras/inlines.c https://github.com/flintlib/flint/pull/1921/files#diff-7b2dabd63368f7f49a164b88343daf990d92523b7a7873f91dce07919466b77c (10)
- M src/ulong_extras/is_probabprime.c https://github.com/flintlib/flint/pull/1921/files#diff-213e9eee57f29012383be5437632b1ef12d54fdde3a99836bd46ab0e79541c55 (8)
Patch Links:
- https://github.com/flintlib/flint/pull/1921.patch
- https://github.com/flintlib/flint/pull/1921.diff
— Reply to this email directly, view it on GitHub https://github.com/flintlib/flint/pull/1921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACO2BX77BYEBV7ODMTTCHDY5BWCNAVCNFSM6AAAAABGE5VBFCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DCMJRHE3TOMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I would really prefer to just insert more forward declarations instead of littering the codebase with pragmas except in very special circumstances.
I would really prefer to just insert more forward declarations instead of littering the codebase with pragmas except in very special circumstances.
How about *-impl.h headers? That would allow us to keep track of global private functions and avoid us from using pragmas.
How about *-impl.h headers? That would allow us to keep track of global private functions and avoid us from using pragmas.
I don't see the need. Nothing prevents us from declaring "global private" functions in the existing headers.
How about *-impl.h headers? That would allow us to keep track of global private functions and avoid us from using pragmas.
I don't see the need. Nothing prevents us from declaring "global private" functions in the existing headers.
Ah, sorry. I have no objection to this. Will do this instead.