This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=72d0935d17e1e40d40c440132b9fb888912610bf

commit 72d0935d17e1e40d40c440132b9fb888912610bf
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Dec 26 20:18:21 2023 +0100

    Dpkg::Vendor::Debian: Split bug-implicit-func from bug feature in qa area
    
    This feature was previously part of the bug feature, and it can now be
    controlled individually.
---
 man/dpkg-buildflags.pod       |  8 ++++++++
 scripts/Dpkg/Vendor/Debian.pm | 16 ++++++++--------
 scripts/t/Dpkg_BuildFlags.t   |  1 +
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/man/dpkg-buildflags.pod b/man/dpkg-buildflags.pod
index c6fee046e..54e15a27b 100644
--- a/man/dpkg-buildflags.pod
+++ b/man/dpkg-buildflags.pod
@@ -453,6 +453,11 @@ problems in the source code or build system.
 
 =over
 
+=item B<bug-implicit-func>
+
+This setting (since dpkg 1.22.3; disabled by default) adds
+B<-Werror=implicit-function-declaration> to B<CFLAGS>.
+
 =item B<bug>
 
 This setting (since dpkg 1.17.4; disabled by default) adds any warning
@@ -463,6 +468,9 @@ with flags set to B<-Werror=array-bounds>, 
B<-Werror=clobbered>,
 B<-Werror=implicit-function-declaration> and
 B<-Werror=volatile-register-var>.
 
+This feature handles B<-Werror=implicit-function-declaration> via
+the B<bug-implicit-func> feature, if that has not been specified.
+
 =item B<canary>
 
 This setting (since dpkg 1.17.14; disabled by default) adds dummy canary
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 3516faea3..2d0779477 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -117,6 +117,7 @@ sub set_build_features {
         },
         qa => {
             bug => 0,
+            'bug-implicit-func' => undef,
             canary => 0,
         },
         reproducible => {
@@ -280,6 +281,10 @@ sub set_build_features {
     # one in the future area.
     $use_feature{future}{lfs} = $use_feature{abi}{lfs};
 
+    ## Area: qa
+
+    $use_feature{qa}{'bug-implicit-func'} //= $use_feature{qa}{bug};
+
     ## Area: reproducible
 
     # Mask features that might have an unsafe usage.
@@ -432,15 +437,10 @@ sub _add_build_flags {
     ## Area: qa
 
     # Warnings that detect actual bugs.
+    if ($flags->use_feature('qa', 'bug-implicit-func')) {
+        $flags->append('CFLAGS', '-Werror=implicit-function-declaration');
+    }
     if ($flags->use_feature('qa', 'bug')) {
-        # C flags
-        my @cflags = qw(
-            implicit-function-declaration
-        );
-        foreach my $warnflag (@cflags) {
-            $flags->append('CFLAGS', "-Werror=$warnflag");
-        }
-
         # C/C++ flags
         my @cfamilyflags = qw(
             array-bounds
diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t
index 6cec9321b..530871c8a 100644
--- a/scripts/t/Dpkg_BuildFlags.t
+++ b/scripts/t/Dpkg_BuildFlags.t
@@ -120,6 +120,7 @@ my %known_features = (
     ) ],
     qa => [ qw(
         bug
+        bug-implicit-func
         canary
     ) ],
     reproducible => [ qw(

-- 
Dpkg.Org's dpkg

Reply via email to