[PATCH] Pacify Oracle Studio 12.6 in init_switches

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Pacify Oracle Studio 12.6 in init_switches

Paul Eggert
* src/main.c (init_switches): Use a cast to convert char const *
to char *.  Without this patch, the compiler complains
‘"src/main.c", line 2643: warning: assignment type mismatch:
pointer to char "=" pointer to const char’.
---
 src/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index 3e9a905..07ca6e6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2639,8 +2639,8 @@ init_switches (void)
 
   for (i = 0; switches[i].c != '\0'; ++i)
     {
-      long_options[i].name = (switches[i].long_name == 0 ? "" :
-                              switches[i].long_name);
+      long_options[i].name = (char *) (switches[i].long_name == 0 ? "" :
+       switches[i].long_name);
       long_options[i].flag = 0;
       long_options[i].val = switches[i].c;
       if (short_option (switches[i].c))
--
2.21.0


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Pacify Oracle Studio 12.6 in init_switches

Dennis Clarke
On 8/27/19 3:40 AM, Paul Eggert wrote:
> * src/main.c (init_switches): Use a cast to convert char const *
> to char *.  Without this patch, the compiler complains
> ‘"src/main.c", line 2643: warning: assignment type mismatch:

Using the c99 compiler with realyl strict CFLAGS I see these :

"src/arscan.c", line 43: warning: tokens ignored at end of directive line
"src/dep.h", line 55: warning: nonportable bit-field type
"src/dep.h", line 64: warning: nonportable bit-field type
"src/function.c", line 41: warning: nonportable bit-field type
"src/function.c", line 42: warning: nonportable bit-field type
"src/main.c", line 1054: warning: only 0 or 2 parameters allowed: main()
"src/read.c", line 1405: warning: statement not reached

However the compile proceeds fine.
Testsuite has a multitude of failures.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Pacify Oracle Studio 12.6 in init_switches

Paul Smith-20
On Tue, 2019-08-27 at 13:37 -0400, Dennis Clarke wrote:
> "src/arscan.c", line 43: warning: tokens ignored at end of directive
> line

This was addressed by Paul's patch "Pacify Oracle Studio 12.6"

> "src/dep.h", line 55: warning: nonportable bit-field type
> "src/dep.h", line 64: warning: nonportable bit-field type
> "src/function.c", line 41: warning: nonportable bit-field type
> "src/function.c", line 42: warning: nonportable bit-field type

These happen on Windows, too: it's because we're using a short as a
bitfield while some compilers allow only "int" and "unsigned int".
Others allow any integral type.

> "src/main.c", line 1054: warning: only 0 or 2 parameters allowed:
> main()

Hm.  Maybe I can use gnulib's environ module instead.  We'll see if
that works on Windows.

> "src/read.c", line 1405: warning: statement not reached

I think this is Paul's "Remove useless code in eval" patch.


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make