Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2024 16:29:59 GMT
From:      Stefan =?utf-8?Q?E=C3=9Fer?= <se@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 06bb8e1dab00 - stable/14 - contrib/bc: fix build with GCC
Message-ID:  <202409031629.483GTxCf024987@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=06bb8e1dab004ccb283f7a20fe84aa1326baf6b7

commit 06bb8e1dab004ccb283f7a20fe84aa1326baf6b7
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-08-27 07:11:58 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-09-03 16:28:14 +0000

    contrib/bc: fix build with GCC
    
    Building with GCC failed with the following error message:
    
     error: to be safe all intermediate pointers in cast from 'char **'
     to 'const char **' must be 'const' qualified [-Werror=cast-qual]
    
    This was caused by main() being declared with "char *argv[]" as the
    3rd parameter, but argv later being passed cast to "const char**":
    
    113 |     if (BC_IS_BC) s = bc_main(argc, (const char**) argv);
        |                                      ^
    
    This is fixed by declaring the 3rd parameter of main() as "const
    char *argv[]".
    
    Reported by:    CI
    MFC after:      3 days
    
    (cherry picked from commit ef5752762ba9ec54d5c02023167d24bcdbb45fd7)
    
    vendor/bc: upgrade to version 7.0.1
    
    This update fixes building bc on FreeBSD with non-default compilers
    (GCC-12, GCC-13). GCC warned about casting argv from non-const to const
    and since warnings are treated as errors, the build failed.
    
    (cherry picked from commit 1e19146fc7692f59e8dfc5da7957e938cd0b81b8)
    (cherry picked from commit 5b0dc991093c82824f6fe566af947f64f5072264)
---
 contrib/bc/NEWS.md           | 6 ++++++
 contrib/bc/include/version.h | 2 +-
 contrib/bc/src/main.c        | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md
index 1775fa0b6533..8156b673ce04 100644
--- a/contrib/bc/NEWS.md
+++ b/contrib/bc/NEWS.md
@@ -1,5 +1,11 @@
 # News
 
+## 7.0.1
+
+This is a production release that fixes a warning using GCC on FreeBSD.
+
+Other users do ***NOT*** need to upgrade.
+
 ## 7.0.0
 
 This is a production release to fix three bugs.
diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h
index 897a19530e3f..4d2f6acfb433 100644
--- a/contrib/bc/include/version.h
+++ b/contrib/bc/include/version.h
@@ -37,6 +37,6 @@
 #define BC_VERSION_H
 
 /// The current version.
-#define VERSION 7.0.0
+#define VERSION 7.0.1
 
 #endif // BC_VERSION_H
diff --git a/contrib/bc/src/main.c b/contrib/bc/src/main.c
index e4a1f7399bb4..da4c27156029 100644
--- a/contrib/bc/src/main.c
+++ b/contrib/bc/src/main.c
@@ -54,7 +54,7 @@
 #include <dc.h>
 
 int
-main(int argc, char* argv[])
+main(int argc, const char* argv[])
 {
 	BcStatus s;
 	char* name;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409031629.483GTxCf024987>