Switch C type safety level to 3 (GCC 14 default), and adjust for GCC 14
No conflict because except for %global build_type_safety 0, the package is still compatibility with GCC 13 (but does not enforce the type safety levels anymore).
This commit is contained in:
parent
a15ac4695e
commit
b13edec098
@ -117,7 +117,7 @@ or:
|
||||
### Controlling Type Safety
|
||||
|
||||
The macro `%build_type_safety_c` can be set to change the C type
|
||||
safety level. The default level is 1, see below. It can be set to 0
|
||||
safety level. The default level is 3, see below. It can be set to 0
|
||||
to get historic levels of type safety. Changing the type safety level
|
||||
may depend on correct `CFLAGS` propagation during the build. The
|
||||
`%build_type_safety_c` macro needs to be set before `CFLAGS`-related
|
||||
@ -130,14 +130,14 @@ the `%build_type_safety_c` level to increase it, spec file should use
|
||||
a construct like this to avoid *lowering* a future default:
|
||||
|
||||
```
|
||||
%if %build_type_safety_c < 2
|
||||
%global build_type_safety_c 2
|
||||
%if %build_type_safety_c < 4
|
||||
%global build_type_safety_c 4
|
||||
%endif
|
||||
```
|
||||
|
||||
At level 0, all C constructs that GCC accepts for backwards
|
||||
compatibility with obsolete language standards are accepted during
|
||||
package builds.
|
||||
package builds. This is achieved by passing `-fpermissive` to GCC.
|
||||
|
||||
At level 1, the following additional error categories are enabled:
|
||||
|
||||
@ -151,6 +151,12 @@ At level 1, the following additional error categories are enabled:
|
||||
Previously, such expressions where we compiled as if a declaration
|
||||
`extern int function_not_defined_anywhere ();` (a prototype-less
|
||||
function declaration) were in scope.
|
||||
* `-Werror=return-mismatch`: Reject `return` statements with missing
|
||||
or extra expressions, based on the declared return type of the
|
||||
function.
|
||||
* `-Wdeclaration-missing-parameter-type`: Reject function declarations
|
||||
that contain unknown type names (which used to be treated as ignored
|
||||
identifier names).
|
||||
|
||||
At level 2, the following error category is enabled in addition:
|
||||
|
||||
|
4
macros
4
macros
@ -400,14 +400,14 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end
|
||||
|
||||
# This can be set to a positive integer to obtain increasing type
|
||||
# safety levels for C. See buildflags.md.
|
||||
%build_type_safety_c 1
|
||||
%build_type_safety_c 3
|
||||
|
||||
# Some linkers default to a build-id algorithm that is not supported by rpmbuild,
|
||||
# so we need to specify the right algorithm to use.
|
||||
%_build_id_flags -Wl,--build-id=sha1
|
||||
|
||||
%_general_options -O2 %{?_lto_cflags} -fexceptions -g -grecord-gcc-switches -pipe
|
||||
%_warning_options -Wall%[%__build_for_lang_any && "%toolchain" == "gcc" ? " -Wno-complain-wrong-lang" : ""]%[%__build_for_lang_c + %__build_for_lang_cxx ? " -Werror=format-security" : ""]%[%__build_for_lang_c && (%build_type_safety_c >= 1) ? " -Werror=implicit-function-declaration -Werror=implicit-int" : ""]%[%__build_for_lang_c && (%build_type_safety_c >= 2) ? " -Werror=int-conversion" : ""]%[%__build_for_lang_c && (%build_type_safety_c >= 3) ? " -Werror=incompatible-pointer-types" : ""]
|
||||
%_warning_options -Wall%[%__build_for_lang_any && "%toolchain" == "gcc" ? " -Wno-complain-wrong-lang" : ""]%[%__build_for_lang_c + %__build_for_lang_cxx ? " -Werror=format-security" : ""]%[%__build_for_lang_c && (%build_type_safety_c == 0) ? " -fpermissive" : ""]%[%__build_for_lang_c && (%build_type_safety_c == 1) ? " -Wno-error=int-conversion" : ""]%[%__build_for_lang_c && (%build_type_safety_c > 0 && %build_type_safety_c < 3) ? " -Wno-error=incompatible-pointer-types" : ""]
|
||||
%_preprocessor_defines %{_fortify_level_flags} -Wp,-D_GLIBCXX_ASSERTIONS
|
||||
|
||||
# Common variables are no longer generated by default by gcc and clang
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 2) When making changes, increment the version (in baserelease) by 1.
|
||||
# rpmdev-bumpspec and other tools update the macro below, which is used
|
||||
# in Version: to get the desired effect.
|
||||
%global baserelease 276
|
||||
%global baserelease 277
|
||||
|
||||
Summary: Red Hat specific rpm configuration files
|
||||
Name: redhat-rpm-config
|
||||
@ -258,6 +258,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua
|
||||
%doc buildflags.md
|
||||
|
||||
%changelog
|
||||
* Mon Jan 15 2024 Florian Weimer <fweimer@redhat.com> - 277-1
|
||||
- Switch C type safety level to 3 (GCC 14 default), and adjust for GCC 14
|
||||
|
||||
* Thu Jan 11 2024 Jan Grulich <jgrulich@redhat.com> - 276-1
|
||||
- Drop qt5-srpm-macros from RHEL 10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user