expr.c (build_chill_function_call): Don't call a variadic function with a non-literal...
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 23 Nov 1999 15:53:22 +0000 (15:53 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 23 Nov 1999 15:53:22 +0000 (15:53 +0000)
        * expr.c (build_chill_function_call): Don't call a variadic
        function with a non-literal format string.

        * grant.c (write_spec_module): Likewise.

        * parse.c (require, expect): Likewise.

        * tasking.c (get_struct_type_name, get_struct_debug_type_name,
        get_tasking_code_name, get_struct_variable_name,
        get_process_wrapper_name, build_start_process): Likewise.

        * typeck.c (valid_array_index_p): Likewise.

From-SVN: r30640

gcc/ch/ChangeLog
gcc/ch/expr.c
gcc/ch/grant.c
gcc/ch/parse.c
gcc/ch/tasking.c
gcc/ch/typeck.c

index 5044fe1ad1cce6607df95c69dbe551b180ddfc36..f7688a1be2ded9f809dadb3366243377d30ec518 100644 (file)
@@ -1,3 +1,18 @@
+1999-11-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * expr.c (build_chill_function_call): Don't call a variadic
+       function with a non-literal format string.
+       
+       * grant.c (write_spec_module): Likewise.
+       
+       * parse.c (require, expect): Likewise.
+
+       * tasking.c (get_struct_type_name, get_struct_debug_type_name,
+       get_tasking_code_name, get_struct_variable_name,
+       get_process_wrapper_name, build_start_process): Likewise.
+
+       * typeck.c (valid_array_index_p): Likewise.
+
 Sun Oct 31 22:33:33 1999  Jeffrey A Law  (law@cygnus.com)
 
        * Makefile.in (convert.o, typeck.o): Depend on output.h
index b919fde8ddb9be2a9867551309c4b5ae65d5829e..e68f3a0b4211582e13b83d92d3d095cc767f8ed2 100644 (file)
@@ -2512,20 +2512,20 @@ build_chill_function_call (function, expr)
  
   if (valtail != 0 && TREE_VALUE (valtail) != void_type_node)
     {
-      const char *errstr = "too many arguments to procedure";
       if (name)
-       error ("%s `%s'", errstr, IDENTIFIER_POINTER (name));
+       error ("too many arguments to procedure `%s'",
+              IDENTIFIER_POINTER (name));
       else
-       error (errstr);
+       error ("too many arguments to procedure");
       return error_mark_node;
     }
   else if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
     {
-      const char *errstr = "too few arguments to procedure";
       if (name)
-       error ("%s `%s'", errstr, IDENTIFIER_POINTER (name));
+       error ("too few arguments to procedure `%s'",
+              IDENTIFIER_POINTER (name));
       else
-       error (errstr);
+       error ("too few arguments to procedure");
       return error_mark_node;
     }
   
index 095080f50c741fb20b83089e13843821b56d26f5..6fc357d93820c718c69e8c8d5556967172692d84 100644 (file)
@@ -2829,9 +2829,8 @@ really_grant_this (decl, granted_decls)
 \f
 /* Write a SPEC MODULE using the declarations in the list DECLS. */
 static int header_written = 0;
-static const char *header_template =
-"--\n-- WARNING: this file was generated by\n\
--- GNUCHILL version %s\n-- based on gcc version %s\n--\n";
+#define HEADER_TEMPLATE "--\n-- WARNING: this file was generated by\n\
+-- GNUCHILL version %s\n-- based on gcc version %s\n--\n"
 
 void
 write_spec_module (decls, granted_decls)
@@ -2850,8 +2849,8 @@ write_spec_module (decls, granted_decls)
     {
       hdr = (char*) alloca (strlen (gnuchill_version)
                            + strlen (version_string)
-                           + strlen (header_template) + 1);
-      sprintf (hdr, header_template, gnuchill_version, version_string);
+                           + sizeof (HEADER_TEMPLATE) /* includes \0 */);
+      sprintf (hdr, HEADER_TEMPLATE, gnuchill_version, version_string);
       APPEND (gstring, hdr);
       header_written = 1;
     }      
index 36913ce7e4bba31cc8b618cb377c4c177cdea64f..e3593df559c2779c6a7efcaa34a5b8a4b0e8ad1c 100644 (file)
@@ -332,11 +332,7 @@ require(token)
      enum terminal token;
 {
   if (PEEK_TOKEN() != token)
-    {
-      char buf[80];
-      sprintf (buf, "internal parser error - expected token %d", (int)token);
-      fatal(buf);
-    }
+    fatal ("internal parser error - expected token %d", (int)token);
   FORWARD_TOKEN();
 }
 
@@ -361,7 +357,7 @@ expect(token, message)
   if (PEEK_TOKEN() != token)
     {
       if (pass == 1)
-       error(message ? message : "syntax error");
+       error("%s", message ? message : "syntax error");
       return 0;
     }
   else
index 3b03dea0056fcb43503e375084b9a60d5f47187e..265572fd5e9e3d7cf7a047b523dbfba72777c49c 100644 (file)
@@ -69,18 +69,19 @@ tree tasking_list = NULL_TREE;
 #define TASK_INFO_STUFF_TYPE(NODE) TREE_VEC_ELT(NODE,4)
 
 /* name template for process argument type */
-static const char * struct_name = "__tmp_%s_arg_type";
+#define STRUCT_NAME "__tmp_%s_arg_type"
 
 /* name template for process arguments for debugging type */
-static const char * struct_debug_name = "__tmp_%s_debug_type";
+#define STRUCT_DEBUG_NAME "__tmp_%s_debug_type"
 
-#if 0
 /* name template for process argument variable */
-static const char * data_name = "__tmp_%s_arg_variable";
-#endif
+#define DATA_NAME  "__tmp_%s_arg_variable"
 
 /* name template for process wrapper */
-static const char * wrapper_name = "__tmp_%s_wrapper";
+#define WRAPPER_NAME "__tmp_%s_wrapper"
+
+/* name template for process code */
+#define SKELNAME "__tmp_%s_code"
 
 extern int ignoring;
 static tree void_ftype_void;
@@ -92,9 +93,9 @@ get_struct_type_name (name)
      tree name;
 {
   const char *idp = IDENTIFIER_POINTER (name);        /* process name */
-  char *tmpname = xmalloc (strlen (idp) + strlen (struct_name) + 1);
+  char *tmpname = xmalloc (strlen (idp) + sizeof (STRUCT_NAME));
 
-  sprintf (tmpname, struct_name, idp);
+  sprintf (tmpname, STRUCT_NAME, idp);
   return get_identifier (tmpname);
 }
 
@@ -103,9 +104,9 @@ get_struct_debug_type_name (name)
      tree name;
 {
   const char *idp = IDENTIFIER_POINTER (name);        /* process name */
-  char *tmpname = xmalloc (strlen (idp) + strlen (struct_debug_name) + 1);
+  char *tmpname = xmalloc (strlen (idp) + sizeof (STRUCT_DEBUG_NAME));
 
-  sprintf (tmpname, struct_debug_name, idp);
+  sprintf (tmpname, STRUCT_DEBUG_NAME, idp);
   return get_identifier (tmpname);
 }
 
@@ -114,12 +115,11 @@ tree
 get_tasking_code_name (name)
      tree name;
 {
-  const char *skelname = "__tmp_%s_code";
   const char *name_str = IDENTIFIER_POINTER (name);
-  char *tmpname  = (char *)alloca (IDENTIFIER_LENGTH (name) +
-                                  strlen (skelname) + 1);
-
-  sprintf (tmpname, skelname, name_str);
+  char *tmpname  = (char *) alloca (IDENTIFIER_LENGTH (name) +
+                                   sizeof (SKELNAME));
+  
+  sprintf (tmpname, SKELNAME, name_str);
   return get_identifier (tmpname);
 }
 
@@ -129,9 +129,9 @@ get_struct_variable_name (name)
      tree name;
 {
   const char *idp = IDENTIFIER_POINTER (name);        /* process name */
-  char *tmpname = xmalloc (strlen (idp) + strlen (data_name) + 1);
+  char *tmpname = xmalloc (strlen (idp) + sizeof (DATA_NAME));
 
-  sprintf (tmpname, data_name, idp);
+  sprintf (tmpname, DATA_NAME, idp);
   return get_identifier (tmpname);
 }
 #endif
@@ -141,9 +141,9 @@ get_process_wrapper_name (name)
     tree name;
 {
   const char *idp = IDENTIFIER_POINTER (name);
-  char *tmpname = xmalloc (strlen (idp) + strlen (wrapper_name) + 1);
+  char *tmpname = xmalloc (strlen (idp) + sizeof (WRAPPER_NAME));
     
-  sprintf (tmpname, wrapper_name, idp);
+  sprintf (tmpname, WRAPPER_NAME, idp);
   return get_identifier (tmpname);
 }
 \f
@@ -627,19 +627,19 @@ build_start_process (process_name, copynum,
   
       if (valtail != 0 && TREE_VALUE (valtail) != void_type_node)
        {
-         const char *errstr = "too many arguments to process";
          if (process_name)
-           error ("%s `%s'", errstr, IDENTIFIER_POINTER (process_name));
+           error ("too many arguments to process `%s'",
+                  IDENTIFIER_POINTER (process_name));
          else
-           error (errstr);
+           error ("too many arguments to process");
        }
       else if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
        {
-         const char *errstr = "too few arguments to process";
          if (process_name)
-           error ("%s `%s'", errstr, IDENTIFIER_POINTER (process_name));
+           error ("too few arguments to process `%s'",
+                  IDENTIFIER_POINTER (process_name));
          else
-           error (errstr);
+           error ("too few arguments to process");
        }
       else
       {
index 8628c95280289196702b5227b1973a97f7ff88eb..d6eeb2a66f12da8400c681b21b42a0b032e81c9e 100644 (file)
@@ -155,7 +155,7 @@ valid_array_index_p (array, idx, error_message, is_varying_lhs)
     {
       if (tree_int_cst_equal (cond, boolean_false_node))
        return idx;       /* condition met at compile time */
-      error (error_message); /* condition failed at compile time */
+      error ("%s", error_message); /* condition failed at compile time */
       return error_mark_node;
     }
   else if (range_checking)