bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash 2.05 type clashes detected by the Sun C compiler


From: Paul Eggert
Subject: Bash 2.05 type clashes detected by the Sun C compiler
Date: Thu, 3 May 2001 16:54:12 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: cc -xarch=v9
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7' 
-DCONF_VENDOR='sun' -DSHELL  -DHAVE_CONFIG_H  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I.  -I.. -I../include -I../lib 
-I/tmp/prefix/include -g
uname output: SunOS sic.twinsun.com 5.7 Generic_106541-15 sun4u sparc 
SUNW,UltraSPARC-IIi-Engine
Machine Type: sparc-sun-solaris2.7

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:
        In a few places in the code, Bash uses a type combination that
        is not allowed by the ISO C standard, e.g. assigning char *
        to unsigned char *.  GCC allows these assignments as an extension,
        but the Sun C compiler warns about them.  The code doesn't actually
        need the chars to be unsigned, so the simplest fix is to remove
        the 'unsigned'.

        In a few other places, Bash passes char const * to char *;
        this assignment isn't caught by GCC because the code doesn't
        use prototypes, but Sun C catches it anyway.  Adding 'const'
        pacifies Sun C.

Repeat-By:

Fix:

2001-05-03  Paul Eggert  <eggert@twinsun.com>

        * bashline.c (prog_complete_return, history_completion_generator):
        Use 'char const *' instead of 'char *' to avoid a Sun C warning.

        * externs.h (zwrite):
        Use char, not unsigned char, to avoid a violation of ISO C type rules.
        * lib/readline/bind.c (rl_parse_and_bind): Likewise.
        (sv_isrchterm): Likewise.
        * lib/readline/isearch.c (_rl_isearch_terminators,
        default_isearch_terminators): Likewise.
        (rl_search_history): Likewise, for a local variable.
        * lib/readline/rlprivate.h (_rl_isearch_terminators): Likewise.

===================================================================
RCS file: bashline.c,v
retrieving revision 2.5.0.1
retrieving revision 2.5.0.2
diff -pu -r2.5.0.1 -r2.5.0.2
--- bashline.c  2001/04/12 21:25:50     2.5.0.1
+++ bashline.c  2001/05/03 23:45:08     2.5.0.2
@@ -782,7 +782,7 @@ find_cmd_name (start)
 
 static char *
 prog_complete_return (text, matchnum)
-     char *text;
+     char const *text;
      int matchnum;
 {
   static int ind;
@@ -1959,11 +1959,11 @@ build_history_completion_array ()
 
 static char *
 history_completion_generator (hint_text, state)
-     char *hint_text;
+     char const *hint_text;
      int state;
 {
   static int local_index, len;
-  static char *text;
+  static char const *text;
 
   /* If this is the first call to the generator, then initialize the
      list of strings to complete over. */
===================================================================
RCS file: externs.h,v
retrieving revision 2.5.0.3
retrieving revision 2.5.0.4
diff -pu -r2.5.0.3 -r2.5.0.4
--- externs.h   2001/05/01 17:14:41     2.5.0.3
+++ externs.h   2001/05/03 23:45:08     2.5.0.4
@@ -261,6 +261,6 @@ extern void zreset __P((void));
 extern void zsyncfd __P((int));
 
 /* declarations for functions defined in lib/sh/zwrite.c */
-extern int zwrite __P((int, unsigned char *, size_t));
+extern int zwrite __P((int, char *, size_t));
 
 #endif /* _EXTERNS_H_ */
===================================================================
RCS file: lib/readline/bind.c,v
retrieving revision 2.5.0.1
retrieving revision 2.5.0.2
diff -pu -r2.5.0.1 -r2.5.0.2
--- lib/readline/bind.c 2001/05/03 20:13:05     2.5.0.1
+++ lib/readline/bind.c 2001/05/03 23:45:08     2.5.0.2
@@ -1203,7 +1203,7 @@ rl_parse_and_bind (string)
   /* Temporary.  Handle old-style keyname with macro-binding. */
   if (*funname == '\'' || *funname == '"')
     {
-      unsigned char useq[2];
+      char useq[2];
       int fl = strlen (funname);
 
       useq[0] = key; useq[1] = '\0';
@@ -1491,7 +1491,7 @@ sv_isrchterm (value)
   v[end] = '\0';
 
   /* The value starts at v + beg.  Translate it into a character string. */
-  _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
+  _rl_isearch_terminators = (char *) xmalloc (2 * strlen (v) + 1);
   rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
   _rl_isearch_terminators[end] = '\0';
 
===================================================================
RCS file: lib/readline/isearch.c,v
retrieving revision 2.5
retrieving revision 2.5.0.1
diff -pu -r2.5 -r2.5.0.1
--- lib/readline/isearch.c      2001/02/14 12:37:01     2.5
+++ lib/readline/isearch.c      2001/05/03 23:45:08     2.5.0.1
@@ -52,7 +52,7 @@
 #include "xmalloc.h"
 
 /* Variables exported to other files in the readline library. */
-unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
+char *_rl_isearch_terminators = (char *) NULL;
 
 /* Variables imported from other files in the readline library. */
 extern HIST_ENTRY *_rl_saved_line_for_history;
@@ -64,7 +64,7 @@ static int rl_search_history __P((int, i
    identical lines many times in a row. */
 static char *prev_line_found;
 
-static unsigned char *default_isearch_terminators = "\033\012";
+static char *default_isearch_terminators = "\033\012";
 
 /* Search backwards through the history looking for a string which is typed
    interactively.  Start with the current line. */
@@ -176,7 +176,7 @@ rl_search_history (direction, invoking_k
   /* The list of characters which terminate the search, but are not
      subsequently executed.  If the variable isearch-terminators has
      been set, we use that value, otherwise we use ESC and C-J. */
-  unsigned char *isearch_terminators;
+  char *isearch_terminators;
 
   RL_SETSTATE(RL_STATE_ISEARCH);
   orig_point = rl_point;
===================================================================
RCS file: lib/readline/rlprivate.h,v
retrieving revision 2.5
retrieving revision 2.5.0.1
diff -pu -r2.5 -r2.5.0.1
--- lib/readline/rlprivate.h    2001/02/14 12:43:14     2.5
+++ lib/readline/rlprivate.h    2001/05/03 23:45:08     2.5.0.1
@@ -221,7 +221,7 @@ extern int _rl_suppress_redisplay;
 extern char *rl_display_prompt;
 
 /* isearch.c */
-extern unsigned char *_rl_isearch_terminators;
+extern char *_rl_isearch_terminators;
 
 /* macro.c */
 extern int _rl_defining_kbd_macro;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]