git: ef5752762ba9 - main - contrib/bc: fix build with GCC
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 27 Aug 2024 07:25:45 UTC
The branch main has been updated by se:
URL: https://cgit.FreeBSD.org/src/commit/?id=ef5752762ba9ec54d5c02023167d24bcdbb45fd7
commit ef5752762ba9ec54d5c02023167d24bcdbb45fd7
Author: Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-08-27 07:11:58 +0000
Commit: Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-08-27 07:25:16 +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
---
contrib/bc/src/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;