Commit Graph

31 Commits

Author SHA1 Message Date
Yury V. Zaytsev
6ea7bd0196 buildsys: disable buggy or unhelpful warnings
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 17:23:22 +01:00
Yury V. Zaytsev
43e6c040de buildsys: add -Wall and -Wextra, remove duplicate flags, set standard to C99
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-11-04 17:23:22 +01:00
Yury V. Zaytsev
3d75fad259 m4: add Werror when checking for compiler flags
Seemingly that at some point clang started accepting _any_ flags,
whereas previously it would error out.

These days, you can give it -Whamsandwich and it will succeed, while
at the same time throwing an annoying warning.

Add -Werror so that everything gets flagged and set accordingly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108082
Cc: Vinson Lee <vlee@freedesktop.org>
Repored-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
62d2580302 Reimplement compiler options checking. 2021-11-21 15:00:39 +03:00
Andrew Borodin
73979369d1 Support __attribute__((fallthrough)) if possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
40b00b5800 Add -Wformat-signedness option.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
4bd1008a03 Add -Wassign-enum compiler wirning.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:37 +03:00
Andrew Borodin
cca1dd2ac3 Add three new compiler warnings:
Wconditional-uninitialized
Wfloat-conversion
Wlogical-not-parentheses

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:37 +03:00
Andrew Borodin
0eae2cb8dc Unify m4 macro names.
Macros get from other projects keep their original names:
gl_FSTYPENAME, AX_PATH_LIB_PCRE, etc.

Macros initially writtem for MC have original names with prefix mc_:
mc_VERSION, mc_CHECK_GLIB, etc

Macros get from other projects and modified for MC keep their
original names with prefix mc_:
mc_cu_PREREQ_STAT_PROG, mc_AC_GET_FS_INFO.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:36 +03:00
Andrew Borodin
d9ad3d2e32 Clarify __attribute ((format (printf))) usage.
Thanks Andreas Mohr <and@gmx.li> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-11-05 14:33:20 +03:00
Andreas Mohr
f023a83502 Ticket #3467: add -Wunreachable-code option and fix relative warnings.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-24 17:59:19 +03:00
Andreas Mohr
dd8521b92d Ticket #3466: add -Wpointer-arith option and fix relative warnings.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-24 17:59:18 +03:00
Andreas Mohr
f1b73ffe6e Ticket #3465: add -Wmissing-variable-declarations option...
...and fix relative warnings.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-24 17:59:18 +03:00
Andreas Mohr
d2713adbc6 Ticket #3463: enable -Wbad-function-cast option and fix relative warnings.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-24 17:59:18 +03:00
Andrew Borodin
2789e6e390 Ticket #3431: add missing default cases.
Introduce -Wswitch-default check.

Some minor cosmetics.

Thanks Andreas Mohr <and at gmx dot li> for original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:50 +03:00
Andreas Mohr
495b4d662f Ticket #3134: fix cflags check when using clang compiler.
With clang invalid cflags usage result in exit 0, we expect exit 1.

$ clang -c -Wmaybe-uninitialized conftest.c ; echo $?
warning: unknown warning option '-Wmaybe-uninitialized'; did you mean '-Wuninitialized'? [-Wunknown-warning-option]
1 warning generated.
0

solution with -Werror on cflags check

$ clang -c -Werror -Wmaybe-uninitialized conftest.c ; echo $?
error: unknown warning option '-Wmaybe-uninitialized'; did you mean '-Wuninitialized'? [-Werror,-Wunknown-warning-option]
1

(Tested with clang 3.6.)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:49 +03:00
Andreas Mohr
850073cbbb Add -Wundef compiler option for future compile checks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:49 +03:00
Andreas Mohr
1a5015aa87 Ticket #3429: fix -Wstrict-prototypes compiler warnings...
...and use compiler option for future compile checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andreas Mohr
ca95dec659 Ticket #3428: fix -Wredundant-decls compiler warnings...
...and use compiler option for future compile checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andreas Mohr
e9b41e5215 Ticket #3427: fix -Wmissing-field-initializers compiler warnings...
...and use compiler option for future compile checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andreas Mohr
24f0e19ac6 Ticket #3426: fix -Wmaybe-uninitialized compiler warnings...
...and use compiler option for future compiles.
Since gcc 4.7.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andrew Borodin
d5afda1188 Clarify check of C compiler flags.
AC_TRY_COMPILE macro is obsolete. Use AC_COMPILE_IFELSE instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-01-16 14:34:34 +04:00
Andrew Borodin
dbbfe5d070 Enable -Wunused-but-set-variable flag by default.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-01-16 14:34:34 +04:00
Sergei Trofimovich
4b3d88f07c m4.include/mc-cflags.m4: report real compiler in MC_CHECK_ONE_CFLAG instead of 'gcc'
Example use: CC=clang ./configure

Before the patch configure reported 'gcc' is being used:

    checking whether gcc accepts -Wcomment... yes
    checking whether gcc accepts -Wdeclaration-after-statement... yes
    checking whether gcc accepts -Wfloat-equal... yes
    checking whether gcc accepts -Wformat... yes

(config.log used proper ${CC})

After the patch it lies a bit less:

    checking whether clang accepts -Wcomment... yes
    checking whether clang accepts -Wdeclaration-after-statement... yes
    checking whether clang accepts -Wfloat-equal... yes
    checking whether clang accepts -Wformat... yes

Reported-by: Agostino Sarubbo <ago@gentoo.org>
Gentoo-bug: http://bugs.gentoo.org/449752
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2013-01-02 16:22:21 +03:00
Andrew Borodin
c34fdcf946 Reorder checks in configure.ac.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-09-10 14:29:52 +03:00
Slava Zanko
1914a54555 Extended list of GCC warning flags.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-12-03 10:59:23 +03:00
Rainer Tammer
476145a0f5 patches for AIX with ncurses support
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2010-01-27 10:04:38 +02:00
Sergei Trofimovich
7670235dfc m4.include/mc-cflags.m4: added -fdiagnostics-show-option (exact warning option)
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-16 11:10:41 +02:00
Sergei Trofimovich
053cd1fc52 m4.include/mc-cflags.m4: sorted CFLAGS (no flags were added or removed)
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-16 11:10:41 +02:00
Sergei Trofimovich
68417a334f cflags: enable -Wformat in maintainer mode
Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-16 11:10:41 +02:00
Slava Zanko
2ffb7c6719 Added checks for compiler options.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2009-10-30 14:41:03 +02:00