Commit b19b4a78 by Mike Stump

63rd Cygnus<->FSF merge

From-SVN: r9311
parent 9fa6d012
Mon Apr 3 16:55:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* repo.c (get_base_filename): Take filename parm, fix logic bug.
* typeck.c (build_compound_expr): Do not warn about a compound expr
in which the first expression has no side effects.
(build_x_compound_expr): Warn here instead.
(build_conditional_expr): Don't warn about a conditional expression
between an enum and the type it promotes to.
* init.c (build_new): Handle initialization of arrays of builtins
properly.
Mon Apr 3 15:08:04 1995 Brendan Kehoe (brendan@lisa.cygnus.com)
* repo.c: Include config.h to get definitions of bcopy and rindex
on systems that don't have them (e.g., SVR4).
Mon Apr 3 14:41:55 1995 Mike Stump <mrs@cygnus.com>
* decl2.c (finish_table): Pass NULL_TREE instead of init to
finish_decl so that it won't try and do error checking on the
initializer.
Mon Apr 3 10:45:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* repo.c (get_base_filename): Analyze COLLECT_GCC_OPTIONS to
determine whether this compile used -c -o.
(open_repo_file): Use get_base_filename. Remove the extension.
(finish_repo): Spit out the values of main_input_filename,
COLLECT_GCC and COLLECT_GCC_OPTIONS.
* parse.y (structsp): Add TYPENAME_KEYWORD complex_type_name.
Sun Apr 2 23:43:51 1995 Jason Merrill <jason@phydeaux.cygnus.com> Sun Apr 2 23:43:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* search.c (compute_access): Don't try to do access control on * search.c (compute_access): Don't try to do access control on
......
...@@ -2291,7 +2291,7 @@ finish_table (name, type, init, publicp) ...@@ -2291,7 +2291,7 @@ finish_table (name, type, init, publicp)
DECL_INITIAL (empty_table) = init; DECL_INITIAL (empty_table) = init;
asmspec = build_string (IDENTIFIER_LENGTH (DECL_NAME (empty_table)), asmspec = build_string (IDENTIFIER_LENGTH (DECL_NAME (empty_table)),
IDENTIFIER_POINTER (DECL_NAME (empty_table))); IDENTIFIER_POINTER (DECL_NAME (empty_table)));
finish_decl (empty_table, init, asmspec, 0, 0); finish_decl (empty_table, NULL_TREE, asmspec, 0, 0);
} }
is_empty = 1; is_empty = 1;
} }
...@@ -2329,7 +2329,7 @@ finish_table (name, type, init, publicp) ...@@ -2329,7 +2329,7 @@ finish_table (name, type, init, publicp)
IDENTIFIER_POINTER (DECL_NAME (empty_table))); IDENTIFIER_POINTER (DECL_NAME (empty_table)));
} }
finish_decl (decl, init, asmspec, 0, 0); finish_decl (decl, NULL_TREE, asmspec, 0, 0);
return decl; return decl;
} }
......
...@@ -3082,7 +3082,8 @@ build_new (placement, decl, init, use_global_new) ...@@ -3082,7 +3082,8 @@ build_new (placement, decl, init, use_global_new)
if (TYPE_NEEDS_CONSTRUCTING (type) || init) if (TYPE_NEEDS_CONSTRUCTING (type) || init)
{ {
if (! TYPE_NEEDS_CONSTRUCTING (type) && ! IS_AGGR_TYPE (type)) if (! TYPE_NEEDS_CONSTRUCTING (type)
&& ! IS_AGGR_TYPE (type) && ! has_array)
{ {
/* New 2.0 interpretation: `new int (10)' means /* New 2.0 interpretation: `new int (10)' means
allocate an int, and initialize it with 10. */ allocate an int, and initialize it with 10. */
......
...@@ -167,7 +167,7 @@ empty_parms () ...@@ -167,7 +167,7 @@ empty_parms ()
%nonassoc IF %nonassoc IF
%nonassoc ELSE %nonassoc ELSE
%left IDENTIFIER TYPENAME PTYPENAME SCSPEC TYPESPEC TYPE_QUAL ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME %left IDENTIFIER TYPENAME PTYPENAME SCSPEC TYPESPEC TYPE_QUAL ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
%left '{' ',' ';' %left '{' ',' ';'
...@@ -2185,7 +2185,8 @@ structsp: ...@@ -2185,7 +2185,8 @@ structsp:
{ $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); } { $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); }
| ENUM complex_type_name | ENUM complex_type_name
{ $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); } { $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); }
| TYPENAME_KEYWORD complex_type_name
{ $$ = $2; }
/* C++ extensions, merged with C to avoid shift/reduce conflicts */ /* C++ extensions, merged with C to avoid shift/reduce conflicts */
| class_head left_curly opt.component_decl_list '}' | class_head left_curly opt.component_decl_list '}'
{ {
......
...@@ -22,18 +22,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -22,18 +22,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Everything should be emitted in a translation unit where it is used. Everything should be emitted in a translation unit where it is used.
The results of the automatic process should be easily reproducible with The results of the automatic process should be easily reproducible with
explicit code. explicit code. */
I'm thinking of compiling with -frepo, running a Perl script to update
files, and then being able to rebuild everything with -fno-implicit.
Full automation can come later. */
#include <stdio.h> #include <stdio.h>
#include "config.h"
#include "tree.h" #include "tree.h"
#include "cp-tree.h" #include "cp-tree.h"
#include "input.h" #include "input.h"
extern char * rindex (); extern char * rindex ();
extern char * getenv ();
static tree pending_repo; static tree pending_repo;
static char repo_name[1024]; static char repo_name[1024];
...@@ -157,12 +155,61 @@ repo_tinfo_used (ti) ...@@ -157,12 +155,61 @@ repo_tinfo_used (ti)
{ {
} }
static char *
save_string (s, len)
char *s;
int len;
{
register char *result = xmalloc (len + 1);
bcopy (s, result, len);
result[len] = 0;
return result;
}
static char *
get_base_filename (filename)
char *filename;
{
char *p = getenv ("COLLECT_GCC_OPTIONS");
char *output = 0;
int compiling = 0;
if (p)
while (*p)
{
char *q = p;
while (*q && *q != ' ') q++;
if (*p == '-' && p[1] == 'o')
{
p += 2;
if (p == q)
{
p++; q++;
if (*q)
while (*q && *q != ' ') q++;
}
output = save_string (p, q - p);
}
else if (*p == '-' && p[1] == 'c')
compiling = 1;
if (*q) q++;
p = q;
}
if (compiling && output)
return output;
return save_string (filename, strlen (filename));
}
static void static void
open_repo_file (filename) open_repo_file (filename)
char *filename; char *filename;
{ {
register char *p, *q; register char *p, *q;
char *file = filename; char *file = get_base_filename (filename);
char *s = rindex (file, '/'); char *s = rindex (file, '/');
if (s == NULL) if (s == NULL)
s = file; s = file;
...@@ -172,10 +219,15 @@ open_repo_file (filename) ...@@ -172,10 +219,15 @@ open_repo_file (filename)
for (p = repo_name, q = file; q < s; ) for (p = repo_name, q = file; q < s; )
*p++ = *q++; *p++ = *q++;
*p++ = '.'; *p++ = '.';
strcpy (p, q); if ((s = rindex (q, '.')) == NULL)
strcpy (p, q);
else
for (; q < s;)
*p++ = *q++;
strcat (p, ".repo"); strcat (p, ".repo");
repo_file = fopen (repo_name, "r"); repo_file = fopen (repo_name, "r");
free (file);
} }
void void
...@@ -187,7 +239,7 @@ init_repo (filename) ...@@ -187,7 +239,7 @@ init_repo (filename)
if (! flag_use_repository) if (! flag_use_repository)
return; return;
open_repo_file (filename); open_repo_file ();
if (repo_file == 0) if (repo_file == 0)
return; return;
...@@ -202,6 +254,7 @@ init_repo (filename) ...@@ -202,6 +254,7 @@ init_repo (filename)
switch (buf[0]) switch (buf[0])
{ {
case 'A': case 'A':
case 'G':
case 'M': case 'M':
break; break;
case 'C': case 'C':
...@@ -228,7 +281,7 @@ reopen_repo_file_for_write () ...@@ -228,7 +281,7 @@ reopen_repo_file_for_write ()
if (repo_file == 0) if (repo_file == 0)
{ {
error ("man't create repository information file `%s'", repo_name); error ("can't create repository information file `%s'", repo_name);
flag_use_repository = 0; flag_use_repository = 0;
} }
} }
...@@ -239,7 +292,7 @@ void ...@@ -239,7 +292,7 @@ void
finish_repo () finish_repo ()
{ {
tree t; tree t;
int changed = 0; char *p;
if (! flag_use_repository) if (! flag_use_repository)
return; return;
...@@ -254,6 +307,16 @@ finish_repo () ...@@ -254,6 +307,16 @@ finish_repo ()
if (repo_file == 0) if (repo_file == 0)
goto out; goto out;
fprintf (repo_file, "M %s\n", main_input_filename);
p = getenv ("COLLECT_GCC");
if (p != 0)
fprintf (repo_file, "G %s\n", p);
p = getenv ("COLLECT_GCC_OPTIONS");
if (p != 0)
fprintf (repo_file, "A %s\n", p);
for (t = pending_repo; t; t = TREE_CHAIN (t)) for (t = pending_repo; t; t = TREE_CHAIN (t))
{ {
tree val = TREE_VALUE (t); tree val = TREE_VALUE (t);
......
...@@ -3483,6 +3483,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) ...@@ -3483,6 +3483,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
all the values of the unsigned type. */ all the values of the unsigned type. */
if (! TREE_UNSIGNED (result_type)) if (! TREE_UNSIGNED (result_type))
/* OK */; /* OK */;
/* Do not warn if both operands are unsigned. */
else if (op0_signed == op1_signed)
/* OK */;
/* Do not warn if the signed quantity is an unsuffixed /* Do not warn if the signed quantity is an unsuffixed
integer literal (or some static constant expression integer literal (or some static constant expression
involving such literals) and it is non-negative. */ involving such literals) and it is non-negative. */
...@@ -4592,11 +4595,13 @@ build_conditional_expr (ifexp, op1, op2) ...@@ -4592,11 +4595,13 @@ build_conditional_expr (ifexp, op1, op2)
cp_error ("enumeral mismatch in conditional expression: `%T' vs `%T'", type1, type2); cp_error ("enumeral mismatch in conditional expression: `%T' vs `%T'", type1, type2);
return error_mark_node; return error_mark_node;
} }
else if (extra_warnings && ! IS_AGGR_TYPE_CODE (code2)) else if (extra_warnings && ! IS_AGGR_TYPE_CODE (code2)
&& type2 != type_promotes_to (type1))
warning ("enumeral and non-enumeral type in conditional expression"); warning ("enumeral and non-enumeral type in conditional expression");
} }
else if (extra_warnings else if (extra_warnings
&& code2 == ENUMERAL_TYPE && ! IS_AGGR_TYPE_CODE (code1)) && code2 == ENUMERAL_TYPE && ! IS_AGGR_TYPE_CODE (code1)
&& type1 != type_promotes_to (type2))
warning ("enumeral and non-enumeral type in conditional expression"); warning ("enumeral and non-enumeral type in conditional expression");
if (code1 != VOID_TYPE) if (code1 != VOID_TYPE)
...@@ -4828,6 +4833,22 @@ build_x_compound_expr (list) ...@@ -4828,6 +4833,22 @@ build_x_compound_expr (list)
TREE_VALUE (list), TREE_VALUE (rest), NULL_TREE); TREE_VALUE (list), TREE_VALUE (rest), NULL_TREE);
if (result) if (result)
return build_x_compound_expr (tree_cons (NULL_TREE, result, TREE_CHAIN (rest))); return build_x_compound_expr (tree_cons (NULL_TREE, result, TREE_CHAIN (rest)));
if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
{
/* the left-hand operand of a comma expression is like an expression
statement: we should warn if it doesn't have any side-effects,
unless it was explicitly cast to (void). */
if ((extra_warnings || warn_unused)
&& !(TREE_CODE (TREE_VALUE(list)) == CONVERT_EXPR
&& TREE_TYPE (TREE_VALUE(list)) == void_type_node))
warning("left-hand operand of comma expression has no effect");
}
#if 0 /* this requires a gcc backend patch to export warn_if_unused_value */
else if (warn_unused)
warn_if_unused_value (TREE_VALUE(list));
#endif
return build_compound_expr (tree_cons (NULL_TREE, TREE_VALUE (list), return build_compound_expr (tree_cons (NULL_TREE, TREE_VALUE (list),
build_tree_list (NULL_TREE, build_x_compound_expr (rest)))); build_tree_list (NULL_TREE, build_x_compound_expr (rest))));
} }
...@@ -4861,25 +4882,9 @@ build_compound_expr (list) ...@@ -4861,25 +4882,9 @@ build_compound_expr (list)
rest = build_compound_expr (TREE_CHAIN (list)); rest = build_compound_expr (TREE_CHAIN (list));
if (! TREE_SIDE_EFFECTS (TREE_VALUE (list))) /* When pedantic, a compound expression cannot be a constant expression. */
{ if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)) && ! pedantic)
/* the left-hand operand of a comma expression is like an expression return rest;
statement: we should warn if it doesn't have any side-effects,
unless it was explicitly cast to (void). */
if ((extra_warnings || warn_unused)
&& !(TREE_CODE (TREE_VALUE(list)) == CONVERT_EXPR
&& TREE_TYPE (TREE_VALUE(list)) == void_type_node))
warning("left-hand operand of comma expression has no effect");
/* When pedantic, a compound expression can be neither an lvalue
nor an integer constant expression. */
if (! pedantic)
return rest;
}
#if 0 /* this requires a gcc backend patch to export warn_if_unused_value */
else if (warn_unused)
warn_if_unused_value (TREE_VALUE(list));
#endif
return build (COMPOUND_EXPR, TREE_TYPE (rest), return build (COMPOUND_EXPR, TREE_TYPE (rest),
break_out_cleanups (TREE_VALUE (list)), rest); break_out_cleanups (TREE_VALUE (list)), rest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment