mirror of
https://github.com/pret/agbcc.git
synced 2026-09-30 21:20:19 -05:00
remove more objc stuff
This commit is contained in:
@@ -1197,13 +1197,13 @@ stmp-multilib-sub:
|
||||
# C language specific files.
|
||||
|
||||
# CYGNUS LOCAL: built in build directory
|
||||
c-parse.o : c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
|
||||
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
|
||||
c-tree.h input.h flags.h system.h toplev.h
|
||||
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c c-parse.c
|
||||
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
|
||||
c-parse.h : c-parse.c
|
||||
c-parse.c : c-parse.y
|
||||
@echo expect 46 shift/reduce conflicts.
|
||||
$(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
|
||||
#c-parse.c : c-parse.y
|
||||
# @echo expect 46 shift/reduce conflicts.
|
||||
# $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
|
||||
c-parse.y : $(srcdir)/c-parse.in
|
||||
echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
|
||||
sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
|
||||
@@ -1221,8 +1221,6 @@ c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
|
||||
output.h toplev.h
|
||||
c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
|
||||
output.h $(EXPR_H) $(RTL_H) toplev.h
|
||||
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \
|
||||
output.h
|
||||
# CYGNUS LOCAL: built in build directory
|
||||
c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
|
||||
c-parse.h input.h flags.h c-gperf.h c-pragma.h \
|
||||
|
||||
@@ -2796,6 +2796,13 @@ unsigned char *yy_cur, *yy_lim;
|
||||
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
|
||||
#define UNGETC(c) ((c), yy_cur--)
|
||||
|
||||
void cpplib_init()
|
||||
{
|
||||
cpp_reader_init (&parse_in);
|
||||
parse_in.opts = &parse_options;
|
||||
cpp_options_init (&parse_options);
|
||||
}
|
||||
|
||||
int
|
||||
yy_get_token ()
|
||||
{
|
||||
|
||||
12
gcc/c-decl.c
12
gcc/c-decl.c
@@ -2615,9 +2615,6 @@ implicitly_declare (functionid)
|
||||
If flag_traditional is set, pushdecl does it top-level. */
|
||||
pushdecl (decl);
|
||||
|
||||
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
||||
maybe_objc_check_decl (decl);
|
||||
|
||||
rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
|
||||
|
||||
if (mesg_implicit_function_declaration && implicit_warning)
|
||||
@@ -4082,8 +4079,6 @@ finish_decl (decl, init, asmspec_tree)
|
||||
{
|
||||
push_obstacks_nochange ();
|
||||
end_temporary_allocation ();
|
||||
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
||||
maybe_objc_check_decl (decl);
|
||||
rest_of_decl_compilation (decl, asmspec,
|
||||
(DECL_CONTEXT (decl) == 0
|
||||
|| TREE_ASM_WRITTEN (decl)),
|
||||
@@ -4092,8 +4087,6 @@ finish_decl (decl, init, asmspec_tree)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
||||
maybe_objc_check_decl (decl);
|
||||
rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0,
|
||||
0);
|
||||
}
|
||||
@@ -4119,8 +4112,6 @@ finish_decl (decl, init, asmspec_tree)
|
||||
|
||||
if (TREE_CODE (decl) == TYPE_DECL)
|
||||
{
|
||||
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
||||
maybe_objc_check_decl (decl);
|
||||
rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0,
|
||||
0);
|
||||
}
|
||||
@@ -5781,7 +5772,6 @@ grokfield (filename, line, declarator, declspecs, width)
|
||||
finish_decl (value, NULL_TREE, NULL_TREE);
|
||||
DECL_INITIAL (value) = width;
|
||||
|
||||
maybe_objc_check_decl (value);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -6106,8 +6096,6 @@ finish_struct (t, fieldlist, attributes)
|
||||
&& TREE_CODE (decl) != TYPE_DECL)
|
||||
{
|
||||
layout_decl (decl, 0);
|
||||
/* This is a no-op in c-lang.c or something real in objc-actions.c. */
|
||||
maybe_objc_check_decl (decl);
|
||||
rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0);
|
||||
if (! toplevel)
|
||||
expand_decl (decl);
|
||||
|
||||
163
gcc/c-lang.c
163
gcc/c-lang.c
@@ -1,163 +0,0 @@
|
||||
/* Language-specific hook definitions for C front end.
|
||||
Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "tree.h"
|
||||
#include "input.h"
|
||||
#include "c-tree.h"
|
||||
#include "c-lex.h"
|
||||
#include "toplev.h"
|
||||
#include "output.h"
|
||||
|
||||
#if USE_CPPLIB
|
||||
#include "cpplib.h"
|
||||
extern char *yy_cur;
|
||||
extern cpp_reader parse_in;
|
||||
extern cpp_options parse_options;
|
||||
#endif
|
||||
|
||||
/* Each of the functions defined here
|
||||
is an alternative to a function in objc-actions.c. */
|
||||
|
||||
int
|
||||
lang_decode_option (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
return c_decode_option (argc, argv);
|
||||
}
|
||||
|
||||
void
|
||||
lang_init_options ()
|
||||
{
|
||||
#if USE_CPPLIB
|
||||
cpp_reader_init (&parse_in);
|
||||
parse_in.opts = &parse_options;
|
||||
cpp_options_init (&parse_options);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
lang_init ()
|
||||
{
|
||||
/* the beginning of the file is a new line; check for # */
|
||||
/* With luck, we discover the real source file's name from that
|
||||
and put it in input_filename. */
|
||||
#if !USE_CPPLIB
|
||||
ungetc (check_newline (), finput);
|
||||
#else
|
||||
check_newline ();
|
||||
yy_cur--;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
lang_finish ()
|
||||
{
|
||||
}
|
||||
|
||||
char *
|
||||
lang_identify ()
|
||||
{
|
||||
return "c";
|
||||
}
|
||||
|
||||
void
|
||||
print_lang_statistics ()
|
||||
{
|
||||
}
|
||||
|
||||
/* used by print-tree.c */
|
||||
|
||||
void
|
||||
lang_print_xnode (file, node, indent)
|
||||
FILE *file ATTRIBUTE_UNUSED;
|
||||
tree node ATTRIBUTE_UNUSED;
|
||||
int indent ATTRIBUTE_UNUSED;
|
||||
{
|
||||
}
|
||||
|
||||
/* Used by c-lex.c, but only for objc. */
|
||||
|
||||
tree
|
||||
lookup_interface (arg)
|
||||
tree arg ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tree
|
||||
is_class_name (arg)
|
||||
tree arg ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
maybe_objc_check_decl (decl)
|
||||
tree decl ATTRIBUTE_UNUSED;
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
maybe_objc_comptypes (lhs, rhs, reflexive)
|
||||
tree lhs ATTRIBUTE_UNUSED;
|
||||
tree rhs ATTRIBUTE_UNUSED;
|
||||
int reflexive ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
tree
|
||||
maybe_objc_method_name (decl)
|
||||
tree decl ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tree
|
||||
maybe_building_objc_message_expr ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
recognize_objc_keyword ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tree
|
||||
build_objc_string (len, str)
|
||||
int len ATTRIBUTE_UNUSED;
|
||||
char *str ATTRIBUTE_UNUSED;
|
||||
{
|
||||
abort ();
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Called at end of parsing, but before end-of-file processing. */
|
||||
|
||||
void
|
||||
finish_file ()
|
||||
{
|
||||
}
|
||||
63
gcc/c-lex.c
63
gcc/c-lex.c
@@ -75,10 +75,6 @@ extern int yy_get_token ();
|
||||
used in a context which makes it a reference to a variable. */
|
||||
tree lastiddecl;
|
||||
|
||||
/* Nonzero enables objc features. */
|
||||
|
||||
int doing_objc_thang;
|
||||
|
||||
extern int yydebug;
|
||||
|
||||
/* File used for outputting assembler code. */
|
||||
@@ -97,8 +93,7 @@ extern FILE *asm_out_file;
|
||||
|
||||
static int maxtoken; /* Current nominal length of token buffer. */
|
||||
char *token_buffer; /* Pointer to token buffer.
|
||||
Actual allocated length is maxtoken + 2.
|
||||
This is not static because objc-parse.y uses it. */
|
||||
Actual allocated length is maxtoken + 2. */
|
||||
|
||||
static int indent_level = 0; /* Number of { minus number of }. */
|
||||
|
||||
@@ -272,8 +267,8 @@ init_lex ()
|
||||
do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
|
||||
if (s) s->name = ""; } while (0)
|
||||
|
||||
if (! doing_objc_thang)
|
||||
UNSET_RESERVED_WORD ("id");
|
||||
|
||||
UNSET_RESERVED_WORD ("id");
|
||||
|
||||
if (flag_traditional)
|
||||
{
|
||||
@@ -1094,7 +1089,6 @@ yylex ()
|
||||
register char *p;
|
||||
register int value;
|
||||
int wide_flag = 0;
|
||||
int objc_flag = 0;
|
||||
|
||||
#if !USE_CPPLIB
|
||||
if (nextchar >= 0)
|
||||
@@ -1160,23 +1154,8 @@ yylex ()
|
||||
goto letter;
|
||||
|
||||
case '@':
|
||||
if (!doing_objc_thang)
|
||||
{
|
||||
value = c;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* '@' may start a constant string object. */
|
||||
register int c = GETC ();
|
||||
if (c == '"')
|
||||
{
|
||||
objc_flag = 1;
|
||||
goto string_constant;
|
||||
}
|
||||
UNGETC (c);
|
||||
/* Fall through to treat '@' as the start of an identifier. */
|
||||
}
|
||||
value = c;
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||
@@ -1194,11 +1173,9 @@ yylex ()
|
||||
case '$':
|
||||
letter:
|
||||
p = token_buffer;
|
||||
while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
|
||||
while (ISALNUM (c) || c == '_' || c == '$')
|
||||
{
|
||||
/* Make sure this char really belongs in an identifier. */
|
||||
if (c == '@' && ! doing_objc_thang)
|
||||
break;
|
||||
if (c == '$')
|
||||
{
|
||||
if (! dollars_in_ident)
|
||||
@@ -1235,16 +1212,6 @@ yylex ()
|
||||
yylval.ttype = ridpointers[(int) ptr->rid];
|
||||
value = (int) ptr->token;
|
||||
|
||||
/* Only return OBJECTNAME if it is a typedef. */
|
||||
if (doing_objc_thang && value == OBJECTNAME)
|
||||
{
|
||||
lastiddecl = lookup_name(yylval.ttype);
|
||||
|
||||
if (lastiddecl == NULL_TREE
|
||||
|| TREE_CODE (lastiddecl) != TYPE_DECL)
|
||||
value = IDENTIFIER;
|
||||
}
|
||||
|
||||
/* Even if we decided to recognize asm, still perhaps warn. */
|
||||
if (pedantic
|
||||
&& (value == ASM_KEYWORD || value == TYPEOF
|
||||
@@ -1285,16 +1252,6 @@ yylex ()
|
||||
TREE_STRING_POINTER (stringval));
|
||||
value = STRING;
|
||||
}
|
||||
else if (doing_objc_thang)
|
||||
{
|
||||
tree objc_interface_decl = is_class_name (yylval.ttype);
|
||||
|
||||
if (objc_interface_decl)
|
||||
{
|
||||
value = CLASSNAME;
|
||||
yylval.ttype = objc_interface_decl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2139,14 +2096,6 @@ yylex ()
|
||||
TREE_TYPE (yylval.ttype) = wchar_array_type_node;
|
||||
value = STRING;
|
||||
}
|
||||
else if (objc_flag)
|
||||
{
|
||||
/* Return an Objective-C @"..." constant string object. */
|
||||
yylval.ttype = build_objc_string (p - (token_buffer + 1),
|
||||
token_buffer + 1);
|
||||
TREE_TYPE (yylval.ttype) = char_array_type_node;
|
||||
value = OBJC_STRING;
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.ttype = build_string (p - (token_buffer + 1),
|
||||
|
||||
668
gcc/c-parse.c
668
gcc/c-parse.c
File diff suppressed because it is too large
Load Diff
@@ -271,7 +271,6 @@ extern void yyprint PROTO ((FILE *, int, YYSTYPE));
|
||||
program: /* empty */
|
||||
{ if (pedantic)
|
||||
pedwarn ("ANSI C forbids an empty source file");
|
||||
finish_file ();
|
||||
}
|
||||
| extdefs
|
||||
{
|
||||
@@ -279,7 +278,6 @@ program: /* empty */
|
||||
get us back to the global binding level. */
|
||||
while (! global_bindings_p ())
|
||||
poplevel (0, 0, 0);
|
||||
finish_file ();
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
17
gcc/c-tree.h
17
gcc/c-tree.h
@@ -160,18 +160,7 @@ struct lang_type
|
||||
/* In a VAR_DECL for an iterator, means we are within
|
||||
an explicit loop over that iterator. */
|
||||
#define ITERATOR_BOUND_P(NODE) ((NODE)->common.readonly_flag)
|
||||
|
||||
/* in c-lang.c and objc-act.c */
|
||||
extern tree lookup_interface PROTO((tree));
|
||||
extern tree is_class_name PROTO((tree));
|
||||
extern void maybe_objc_check_decl PROTO((tree));
|
||||
extern void finish_file PROTO((void));
|
||||
extern int maybe_objc_comptypes PROTO((tree, tree, int));
|
||||
extern tree maybe_building_objc_message_expr PROTO((void));
|
||||
extern tree maybe_objc_method_name PROTO((tree));
|
||||
extern int recognize_objc_keyword PROTO((void));
|
||||
extern tree build_objc_string PROTO((int, char *));
|
||||
|
||||
|
||||
/* in c-aux-info.c */
|
||||
extern void gen_aux_info_record PROTO((tree, int, int, int));
|
||||
|
||||
@@ -550,10 +539,6 @@ extern int warn_long_long;
|
||||
|
||||
extern int system_header_p;
|
||||
|
||||
/* Nonzero enables objc features. */
|
||||
|
||||
extern int doing_objc_thang;
|
||||
|
||||
/* In c-decl.c */
|
||||
extern void finish_incomplete_decl PROTO((tree));
|
||||
|
||||
|
||||
@@ -508,11 +508,6 @@ comptypes (type1, type2)
|
||||
break;
|
||||
}
|
||||
|
||||
case RECORD_TYPE:
|
||||
if (maybe_objc_comptypes (t1, t2, 0) == 1)
|
||||
val = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -528,10 +523,6 @@ comp_target_types (ttl, ttr)
|
||||
{
|
||||
int val;
|
||||
|
||||
/* Give maybe_objc_comptypes a crack at letting these types through. */
|
||||
if ((val = maybe_objc_comptypes (ttl, ttr, 1)) >= 0)
|
||||
return val;
|
||||
|
||||
val = comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (ttl)),
|
||||
TYPE_MAIN_VARIANT (TREE_TYPE (ttr)));
|
||||
|
||||
@@ -4062,9 +4053,6 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
|
||||
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
|
||||
{
|
||||
overflow_warning (rhs);
|
||||
/* Check for Objective-C protocols. This will issue a warning if
|
||||
there are protocol violations. No need to use the return value. */
|
||||
maybe_objc_comptypes (type, rhstype, 0);
|
||||
return rhs;
|
||||
}
|
||||
|
||||
@@ -4266,14 +4254,8 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
|
||||
{
|
||||
if (funname)
|
||||
{
|
||||
tree selector = maybe_building_objc_message_expr ();
|
||||
|
||||
if (selector && parmnum > 2)
|
||||
error ("incompatible type for argument %d of `%s'",
|
||||
parmnum - 2, IDENTIFIER_POINTER (selector));
|
||||
else
|
||||
error ("incompatible type for argument %d of `%s'",
|
||||
parmnum, IDENTIFIER_POINTER (funname));
|
||||
error ("incompatible type for argument %d of `%s'",
|
||||
parmnum, IDENTIFIER_POINTER (funname));
|
||||
}
|
||||
else
|
||||
error ("incompatible type for argument %d of indirect function call",
|
||||
@@ -4288,8 +4270,7 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
|
||||
/* Print a warning using MSG.
|
||||
It gets OPNAME as its one parameter.
|
||||
If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'".
|
||||
FUNCTION and ARGNUM are handled specially if we are building an
|
||||
Objective-C selector. */
|
||||
*/
|
||||
|
||||
static void
|
||||
warn_for_assignment (msg, opname, function, argnum)
|
||||
@@ -4303,13 +4284,6 @@ warn_for_assignment (msg, opname, function, argnum)
|
||||
|
||||
if (opname == 0)
|
||||
{
|
||||
tree selector = maybe_building_objc_message_expr ();
|
||||
|
||||
if (selector && argnum > 2)
|
||||
{
|
||||
function = selector;
|
||||
argnum -= 2;
|
||||
}
|
||||
if (function)
|
||||
{
|
||||
/* Function name is known; supply it. */
|
||||
|
||||
@@ -95,16 +95,6 @@ do { fprintf (FILE, "\t%s\t", ASM_LONG); \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_IDENTIFY_GCC
|
||||
/* Default the definition, only if ASM_IDENTIFY_GCC is not set,
|
||||
because if it is set, we might not want ASM_IDENTIFY_LANGUAGE
|
||||
outputting labels, if we do want it to, then it must be defined
|
||||
in the tm.h file. */
|
||||
#ifndef ASM_IDENTIFY_LANGUAGE
|
||||
#define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This is how we tell the assembler to equate two values. */
|
||||
#ifdef SET_ASM_OP
|
||||
#ifndef ASM_OUTPUT_DEF
|
||||
|
||||
@@ -684,8 +684,6 @@ print_node (file, prefix, node, indent)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (TREE_CODE_CLASS (TREE_CODE (node)) == 'x')
|
||||
lang_print_xnode (file, node, indent);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,317 +0,0 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@gnu.org.
|
||||
|
||||
# This file was written by Rob Savoye. (rob@cygnus.com)
|
||||
|
||||
# The default option list can be overridden by
|
||||
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
|
||||
|
||||
if ![info exists TORTURE_OPTIONS] {
|
||||
# FIXME: We should test -g at least once.
|
||||
set TORTURE_OPTIONS [list \
|
||||
{ -O0 } { -O1 } { -O2 } \
|
||||
{ -O2 -fomit-frame-pointer -finline-functions } \
|
||||
{ -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \
|
||||
{ -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops } \
|
||||
{ -Os }]
|
||||
}
|
||||
|
||||
|
||||
# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
|
||||
# one for testcases without loops.
|
||||
|
||||
set torture_with_loops $TORTURE_OPTIONS
|
||||
set torture_without_loops ""
|
||||
foreach option $TORTURE_OPTIONS {
|
||||
if ![string match "*loop*" $option] {
|
||||
lappend torture_without_loops $option
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# f-torture-compile -- runs the Tege C-torture test
|
||||
#
|
||||
# SRC is the full pathname of the testcase.
|
||||
# OPTION is the specific compiler flag we're testing (eg: -O2).
|
||||
#
|
||||
proc f-torture-compile { src option } {
|
||||
global output
|
||||
global srcdir tmpdir
|
||||
global host_triplet
|
||||
|
||||
set output "$tmpdir/[file tail [file rootname $src]].o"
|
||||
|
||||
regsub "^$srcdir/?" $src "" testcase
|
||||
# If we couldn't rip $srcdir out of `src' then just do the best we can.
|
||||
# The point is to reduce the unnecessary noise in the logs. Don't strip
|
||||
# out too much because different testcases with the same name can confuse
|
||||
# `test-tool'.
|
||||
if [string match "/*" $testcase] {
|
||||
set testcase "[file tail [file dirname $src]]/[file tail $src]"
|
||||
}
|
||||
|
||||
verbose "Testing $testcase, $option" 1
|
||||
|
||||
# Run the compiler and analyze the results.
|
||||
set options ""
|
||||
lappend options "additional_flags=-w $option"
|
||||
|
||||
set comp_output [g77_target_compile "$src" "$output" object $options];
|
||||
|
||||
# Set a few common compiler messages.
|
||||
set fatal_signal "*77*: Internal compiler error: program*got fatal signal"
|
||||
|
||||
if [string match "$fatal_signal 6" $comp_output] then {
|
||||
g77_fail $testcase "Got Signal 6, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
if [string match "$fatal_signal 11" $comp_output] then {
|
||||
g77_fail $testcase "Got Signal 11, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
# We shouldn't get these because of -w, but just in case.
|
||||
if [string match "*77*:*warning:*" $comp_output] then {
|
||||
warning "$testcase: (with warnings) $option"
|
||||
send_log "$comp_output\n"
|
||||
unresolved "$testcase, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
set unsupported_message [g77_check_unsupported_p $comp_output]
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$testcase: $unsupported_message"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
# remove any leftover LF/CR to make sure any output is legit
|
||||
regsub -all -- "\[\r\n\]*" $comp_output "" comp_output
|
||||
# If any message remains, we fail.
|
||||
if ![string match "" $comp_output] then {
|
||||
g77_fail $testcase $option
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
g77_pass $testcase $option
|
||||
remote_file build delete $output
|
||||
}
|
||||
|
||||
#
|
||||
# f-torture-execute -- utility to compile and execute a testcase
|
||||
#
|
||||
# SRC is the full pathname of the testcase.
|
||||
#
|
||||
# If the testcase has an associated .x file, we source that to run the
|
||||
# test instead. We use .x so that we don't lengthen the existing filename
|
||||
# to more than 14 chars.
|
||||
#
|
||||
proc f-torture-execute { src } {
|
||||
global tmpdir tool srcdir output
|
||||
|
||||
# Check for alternate driver.
|
||||
if [file exists [file rootname $src].x] {
|
||||
verbose "Using alternate driver [file rootname [file tail $src]].x" 2
|
||||
set done_p 0
|
||||
catch "set done_p \[source [file rootname $src].x\]"
|
||||
if { $done_p } {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Look for a loop within the source code - if we don't find one,
|
||||
# don't pass -funroll[-all]-loops.
|
||||
global torture_with_loops torture_without_loops
|
||||
if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
|
||||
set option_list $torture_with_loops
|
||||
} else {
|
||||
set option_list $torture_without_loops
|
||||
}
|
||||
|
||||
set executable $tmpdir/[file tail [file rootname $src].x]
|
||||
|
||||
regsub "^$srcdir/?" $src "" testcase
|
||||
# If we couldn't rip $srcdir out of `src' then just do the best we can.
|
||||
# The point is to reduce the unnecessary noise in the logs. Don't strip
|
||||
# out too much because different testcases with the same name can confuse
|
||||
# `test-tool'.
|
||||
if [string match "/*" $testcase] {
|
||||
set testcase "[file tail [file dirname $src]]/[file tail $src]"
|
||||
}
|
||||
|
||||
foreach option $option_list {
|
||||
# torture_{compile,execute}_xfail are set by the .x script
|
||||
# (if present)
|
||||
if [info exists torture_compile_xfail] {
|
||||
setup_xfail $torture_compile_xfail
|
||||
}
|
||||
remote_file build delete $executable
|
||||
verbose "Testing $testcase, $option" 1
|
||||
|
||||
set options ""
|
||||
lappend options "additional_flags=-w $option"
|
||||
set comp_output [g77_target_compile "$src" "$executable" executable $options];
|
||||
|
||||
# Set a few common compiler messages.
|
||||
set fatal_signal "*77*: Internal compiler error: program*got fatal signal"
|
||||
|
||||
if [string match "$fatal_signal 6" $comp_output] then {
|
||||
g77_fail $testcase "Got Signal 6, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
if [string match "$fatal_signal 11" $comp_output] then {
|
||||
g77_fail $testcase "Got Signal 11, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
# We shouldn't get these because of -w, but just in case.
|
||||
if [string match "*77*:*warning:*" $comp_output] then {
|
||||
warning "$testcase: (with warnings) $option"
|
||||
send_log "$comp_output\n"
|
||||
unresolved "$testcase, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
set unsupported_message [g77_check_unsupported_p $comp_output]
|
||||
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$testcase: $unsupported_message"
|
||||
continue
|
||||
} elseif ![file exists $executable] {
|
||||
if ![is3way] {
|
||||
fail "$testcase compilation, $option"
|
||||
untested "$testcase execution, $option"
|
||||
continue
|
||||
} else {
|
||||
# FIXME: since we can't test for the existance of a remote
|
||||
# file without short of doing an remote file list, we assume
|
||||
# that since we got no output, it must have compiled.
|
||||
pass "$testcase compilation, $option"
|
||||
}
|
||||
} else {
|
||||
pass "$testcase compilation, $option"
|
||||
}
|
||||
|
||||
# See if this source file uses "long long" types, if it does, and
|
||||
# no_long_long is set, skip execution of the test.
|
||||
if [target_info exists no_long_long] then {
|
||||
if [expr [search_for $src "integer\*8"]] then {
|
||||
untested "$testcase execution, $option"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists torture_execute_xfail] {
|
||||
setup_xfail $torture_execute_xfail
|
||||
}
|
||||
|
||||
set result [g77_load "$executable" "" ""]
|
||||
set status [lindex $result 0];
|
||||
set output [lindex $result 1];
|
||||
if { $status == "pass" } {
|
||||
remote_file build delete $executable
|
||||
}
|
||||
$status "$testcase execution, $option"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# search_for -- looks for a string match in a file
|
||||
#
|
||||
proc search_for { file pattern } {
|
||||
set fd [open $file r]
|
||||
while { [gets $fd cur_line]>=0 } {
|
||||
set lower [string tolower $cur_line]
|
||||
if [regexp "$pattern" $lower] then {
|
||||
close $fd
|
||||
return 1
|
||||
}
|
||||
}
|
||||
close $fd
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# f-torture -- the f-torture testcase source file processor
|
||||
#
|
||||
# This runs compilation only tests (no execute tests).
|
||||
# SRC is the full pathname of the testcase, or just a file name in which case
|
||||
# we prepend $srcdir/$subdir.
|
||||
#
|
||||
# If the testcase has an associated .x file, we source that to run the
|
||||
# test instead. We use .x so that we don't lengthen the existing filename
|
||||
# to more than 14 chars.
|
||||
#
|
||||
proc f-torture { args } {
|
||||
global srcdir subdir
|
||||
|
||||
set src [lindex $args 0];
|
||||
if { [llength $args] > 1 } {
|
||||
set options [lindex $args 1];
|
||||
} else {
|
||||
set options ""
|
||||
}
|
||||
|
||||
# Prepend $srdir/$subdir if missing.
|
||||
if ![string match "*/*" $src] {
|
||||
set src "$srcdir/$subdir/$src"
|
||||
}
|
||||
|
||||
# Check for alternate driver.
|
||||
if [file exists [file rootname $src].x] {
|
||||
verbose "Using alternate driver [file rootname [file tail $src]].x" 2
|
||||
set done_p 0
|
||||
catch "set done_p \[source [file rootname $src].x\]"
|
||||
if { $done_p } {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Look for a loop within the source code - if we don't find one,
|
||||
# don't pass -funroll[-all]-loops.
|
||||
global torture_with_loops torture_without_loops
|
||||
if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
|
||||
set option_list $torture_with_loops
|
||||
} else {
|
||||
set option_list $torture_without_loops
|
||||
}
|
||||
|
||||
# loop through all the options
|
||||
foreach option $option_list {
|
||||
# torture_compile_xfail is set by the .x script (if present)
|
||||
if [info exists torture_compile_xfail] {
|
||||
setup_xfail $torture_compile_xfail
|
||||
}
|
||||
|
||||
f-torture-compile $src "$option $options"
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
# Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-g++@prep.ai.mit.edu
|
||||
|
||||
# Define g++ callbacks for dg.exp.
|
||||
|
||||
load_lib dg.exp
|
||||
|
||||
proc g++-dg-test { prog do_what extra_tool_flags } {
|
||||
# Set up the compiler flags, based on what we're going to do.
|
||||
|
||||
switch $do_what {
|
||||
"preprocess" {
|
||||
set compile_type "preprocess"
|
||||
set output_file "[file rootname [file tail $prog]].i"
|
||||
}
|
||||
"compile" {
|
||||
set compile_type "assembly"
|
||||
set output_file "[file rootname [file tail $prog]].s"
|
||||
}
|
||||
"assemble" {
|
||||
set compile_type "object"
|
||||
set output_file "[file rootname [file tail $prog]].o"
|
||||
}
|
||||
"link" {
|
||||
set compile_type "executable"
|
||||
set output_file "a.out"
|
||||
# The following line is needed for targets like the i960 where
|
||||
# the default output file is b.out. Sigh.
|
||||
}
|
||||
"run" {
|
||||
set compile_type "executable"
|
||||
# FIXME: "./" is to cope with "." not being in $PATH.
|
||||
# Should this be handled elsewhere?
|
||||
# YES.
|
||||
set output_file "./a.out"
|
||||
# This is the only place where we care if an executable was
|
||||
# created or not. If it was, dg.exp will try to run it.
|
||||
remote_file build delete $output_file;
|
||||
}
|
||||
default {
|
||||
perror "$do_what: not a valid dg-do keyword"
|
||||
return ""
|
||||
}
|
||||
}
|
||||
set options ""
|
||||
if { $extra_tool_flags != "" } {
|
||||
lappend options "additional_flags=$extra_tool_flags"
|
||||
}
|
||||
|
||||
set comp_output [g++_target_compile "$prog" "$output_file" "$compile_type" $options];
|
||||
|
||||
return [list $comp_output $output_file]
|
||||
}
|
||||
|
||||
|
||||
proc g++-dg-prune { system text } {
|
||||
|
||||
# If we see "region xxx is full" then the testcase is too big for ram.
|
||||
# This is tricky to deal with in a large testsuite like c-torture so
|
||||
# deal with it here. Just mark the testcase as unsupported.
|
||||
if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] {
|
||||
# The format here is important. See dg.exp.
|
||||
return "::unsupported::memory full"
|
||||
}
|
||||
|
||||
return $text
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-g++@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye (rob@cygnus.com)
|
||||
# Many modifications by Jeffrey Wheat (cassidy@cygnus.com)
|
||||
# With modifications by Mike Stump <mrs@cygnus.com>.
|
||||
|
||||
#
|
||||
# g++ support library routines
|
||||
#
|
||||
|
||||
#
|
||||
# GXX_UNDER_TEST is the compiler under test.
|
||||
#
|
||||
|
||||
|
||||
set gpp_compile_options ""
|
||||
|
||||
#
|
||||
# g++_version -- extract and print the version number of the compiler
|
||||
#
|
||||
proc g++_version { } {
|
||||
global GXX_UNDER_TEST
|
||||
|
||||
# ignore any arguments after the command
|
||||
set compiler [lindex $GXX_UNDER_TEST 0]
|
||||
|
||||
# verify that the compiler exists
|
||||
if { [is_remote host] || [which $compiler] != 0 } then {
|
||||
set tmp [remote_exec host "$compiler -v"]
|
||||
set status [lindex $tmp 0];
|
||||
set output [lindex $tmp 1];
|
||||
regexp "version.*$" $output version
|
||||
if { $status == 0 && [info exists version] } then {
|
||||
if [is_remote host] {
|
||||
clone_output "$compiler $version\n"
|
||||
} else {
|
||||
clone_output "[which $compiler] $version\n"
|
||||
}
|
||||
} else {
|
||||
clone_output "Couldn't determine version of [which $compiler]\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# g++_init -- called at the start of each subdir of tests
|
||||
#
|
||||
|
||||
proc g++_init { args } {
|
||||
global subdir
|
||||
global gpp_initialized
|
||||
global base_dir
|
||||
global tmpdir
|
||||
global libdir
|
||||
global gluefile wrap_flags;
|
||||
global objdir srcdir
|
||||
global ALWAYS_CXXFLAGS
|
||||
global TOOL_EXECUTABLE TOOL_OPTIONS
|
||||
global GXX_UNDER_TEST
|
||||
|
||||
if ![info exists GXX_UNDER_TEST] then {
|
||||
if [info exists TOOL_EXECUTABLE] {
|
||||
set GXX_UNDER_TEST $TOOL_EXECUTABLE;
|
||||
} else {
|
||||
if [is_remote host] {
|
||||
set GXX_UNDER_TEST [transform c++]
|
||||
} else {
|
||||
set GXX_UNDER_TEST [findfile $base_dir/../xgcc "$base_dir/../xgcc -B$base_dir/../" [findfile $base_dir/xgcc "$base_dir/xgcc -B$base_dir/" [transform c++]]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Bleah, nasty. Bad taste.
|
||||
if [ishost "*-dos-*" ] {
|
||||
regsub "c\\+\\+" "$GXX_UNDER_TEST" "gcc" GXX_UNDER_TEST
|
||||
}
|
||||
|
||||
if ![is_remote host] {
|
||||
if { [which $GXX_UNDER_TEST] == 0 } then {
|
||||
perror "GXX_UNDER_TEST does not exist"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
if ![info exists tmpdir] {
|
||||
set tmpdir "/tmp"
|
||||
}
|
||||
|
||||
if [info exists gluefile] {
|
||||
unset gluefile
|
||||
}
|
||||
|
||||
if { [target_info needs_status_wrapper] != "" } {
|
||||
set gluefile ${tmpdir}/testglue.o;
|
||||
set result [build_wrapper $gluefile];
|
||||
if { $result != "" } {
|
||||
set gluefile [lindex $result 0];
|
||||
set wrap_flags [lindex $result 1];
|
||||
} else {
|
||||
unset gluefile
|
||||
}
|
||||
}
|
||||
|
||||
set ALWAYS_CXXFLAGS ""
|
||||
|
||||
if ![is_remote host] {
|
||||
lappend ALWAYS_CXXFLAGS "additional_flags=[g++_include_flags]";
|
||||
lappend ALWAYS_CXXFLAGS "ldflags=[g++_link_flags]";
|
||||
lappend ALWAYS_CXXFLAGS "incdir=$base_dir/../include"
|
||||
}
|
||||
|
||||
if [info exists TOOL_OPTIONS] {
|
||||
lappend ALWAYS_CXXFLAGS "additional_flags=$TOOL_OPTIONS";
|
||||
}
|
||||
|
||||
verbose -log "ALWAYS_CXXFLAGS set to $ALWAYS_CXXFLAGS"
|
||||
|
||||
verbose "g++ is initialized" 3
|
||||
}
|
||||
|
||||
|
||||
proc g++_target_compile { source dest type options } {
|
||||
global tmpdir;
|
||||
global gpp_compile_options
|
||||
global gluefile wrap_flags
|
||||
global ALWAYS_CXXFLAGS;
|
||||
global GXX_UNDER_TEST;
|
||||
|
||||
if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
lappend options "ldflags=${wrap_flags}"
|
||||
}
|
||||
|
||||
lappend options "additional_flags=[libio_include_flags]"
|
||||
lappend options "compiler=$GXX_UNDER_TEST";
|
||||
|
||||
set options [concat $options $gpp_compile_options]
|
||||
|
||||
set options [concat $options "$ALWAYS_CXXFLAGS"];
|
||||
|
||||
if { [regexp "(^| )-frepo( |$)" $options] && \
|
||||
[regexp "\.o(|bj)$" $dest] } then {
|
||||
regsub "\.o(|bj)$" $dest ".rpo" rponame
|
||||
exec rm -f $rponame
|
||||
}
|
||||
|
||||
return [target_compile $source $dest $type $options]
|
||||
}
|
||||
|
||||
proc g++_exit { args } {
|
||||
global gluefile;
|
||||
|
||||
if [info exists gluefile] {
|
||||
file_on_build delete $gluefile;
|
||||
unset gluefile;
|
||||
}
|
||||
}
|
||||
|
||||
# If this is an older version of dejagnu (without runtest_file_p),
|
||||
# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
|
||||
# This can be deleted after the next dejagnu release.
|
||||
|
||||
if { [info procs runtest_file_p] == "" } then {
|
||||
proc runtest_file_p { runtests testcase } {
|
||||
if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
|
||||
if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
# Provide a definition of this if missing (delete after next dejagnu release).
|
||||
|
||||
if { [info procs prune_warnings] == "" } then {
|
||||
proc prune_warnings { text } {
|
||||
return $text
|
||||
}
|
||||
}
|
||||
|
||||
# Utility used by mike-g++.exp and old-dejagnu.exp.
|
||||
# Check the compiler(/assembler/linker) output for text indicating that
|
||||
# the testcase should be marked as "unsupported".
|
||||
#
|
||||
# When dealing with a large number of tests, it's difficult to weed out the
|
||||
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
|
||||
# of memory). There are various ways to deal with this. Here's one.
|
||||
# Fortunately, all of the cases where this is likely to happen will be using
|
||||
# gld so we can tell what the error text will look like.
|
||||
|
||||
proc ${tool}_check_unsupported_p { output } {
|
||||
if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
|
||||
return "memory full"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
proc ${tool}_option_help { } {
|
||||
send_user "--additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated."
|
||||
}
|
||||
|
||||
proc ${tool}_option_proc { option } {
|
||||
if[regexp "^--additional_options," $option] {
|
||||
global gpp_compile_options
|
||||
regsub "--additional_options," $option "" option
|
||||
foreach x [split $option ","] {
|
||||
lappend gpp_compile_options "additional_flags=$x"
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-g77@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye (rob@cygnus.com)
|
||||
# Currently maintained by Doug Evans (dje@cygnus.com)
|
||||
|
||||
# This file is loaded by the tool init file (eg: unix.exp). It provides
|
||||
# default definitions for g77_start, etc. and other supporting cast members.
|
||||
|
||||
# These globals are used by g77_start if no compiler arguments are provided.
|
||||
# They are also used by the various testsuites to define the environment:
|
||||
# where to find stdio.h, libc.a, etc.
|
||||
|
||||
#
|
||||
# G77_UNDER_TEST is the compiler under test.
|
||||
#
|
||||
|
||||
#
|
||||
# default_g77_version -- extract and print the version number of the compiler
|
||||
#
|
||||
|
||||
proc default_g77_version { } {
|
||||
global G77_UNDER_TEST
|
||||
|
||||
g77_init;
|
||||
|
||||
# ignore any arguments after the command
|
||||
set compiler [lindex $G77_UNDER_TEST 0]
|
||||
|
||||
if ![is_remote host] {
|
||||
set compiler_name [which $compiler];
|
||||
} else {
|
||||
set compiler_name $compiler;
|
||||
}
|
||||
|
||||
# verify that the compiler exists
|
||||
if { $compiler_name != 0 } then {
|
||||
set options ""
|
||||
|
||||
lappend options "additional_flags=-v"
|
||||
set tmp [g77_target_compile "" "" "none" $options]
|
||||
regexp "g77 version\[^\n\]*" $tmp version
|
||||
if { [info exists version] } then {
|
||||
clone_output "$compiler_name $version\n"
|
||||
} else {
|
||||
clone_output "Couldn't determine version of $compiler_name: $tmp\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Call g77_version. We do it this way so we can override it if needed.
|
||||
#
|
||||
proc g77_version { } {
|
||||
default_g77_version;
|
||||
}
|
||||
|
||||
#
|
||||
# g77_init -- called at the start of each .exp script.
|
||||
#
|
||||
# There currently isn't much to do, but always using it allows us to
|
||||
# make some enhancements without having to go back and rewrite the scripts.
|
||||
#
|
||||
|
||||
set g77_initialized 0
|
||||
|
||||
proc g77_init { args } {
|
||||
global tmpdir
|
||||
global libdir
|
||||
global gluefile wrap_flags
|
||||
global g77_initialized
|
||||
global G77_UNDER_TEST
|
||||
global TOOL_EXECUTABLE
|
||||
|
||||
if { $g77_initialized == 1 } { return; }
|
||||
|
||||
if ![info exists G77_UNDER_TEST] then {
|
||||
if [info exists TOOL_EXECUTABLE] {
|
||||
set G77_UNDER_TEST $TOOL_EXECUTABLE;
|
||||
} else {
|
||||
set G77_UNDER_TEST [find_g77]
|
||||
}
|
||||
}
|
||||
|
||||
if ![info exists tmpdir] then {
|
||||
set tmpdir /tmp
|
||||
}
|
||||
if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } {
|
||||
set gluefile ${tmpdir}/testglue.o;
|
||||
set result [build_wrapper $gluefile];
|
||||
if { $result != "" } {
|
||||
set gluefile [lindex $result 0];
|
||||
set wrap_flags [lindex $result 1];
|
||||
} else {
|
||||
unset gluefile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc g77_target_compile { source dest type options } {
|
||||
global tmpdir;
|
||||
global gluefile wrap_flags;
|
||||
global G77_UNDER_TEST
|
||||
global TOOL_OPTIONS
|
||||
|
||||
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
lappend options "ldflags=$wrap_flags"
|
||||
}
|
||||
|
||||
if [target_info exists g77,stack_size] {
|
||||
lappend options "additional_flags=-DSTACK_SIZE=[target_info g77,stack_size]"
|
||||
}
|
||||
if [target_info exists g77,no_trampolines] {
|
||||
lappend options "additional_flags=-DNO_TRAMPOLINES"
|
||||
}
|
||||
if [target_info exists g77,no_label_values] {
|
||||
lappend options "additional_flags=-DNO_LABEL_VALUES"
|
||||
}
|
||||
if [info exists TOOL_OPTIONS] {
|
||||
lappend options "additional_flags=$TOOL_OPTIONS"
|
||||
}
|
||||
if [target_info exists g77,no_varargs] {
|
||||
lappend options "additional_flags=-DNO_VARARGS"
|
||||
}
|
||||
if ![is_remote host] {
|
||||
set gccpath "[get_multilibs]"
|
||||
set libg2c_dir [lookfor_file ${gccpath} libf2c/libg2c.a]
|
||||
if { $libg2c_dir != "" } {
|
||||
set libg2c_link_flags "-L[file dirname ${libg2c_dir}]"
|
||||
lappend options "additional_flags=${libg2c_link_flags}"
|
||||
}
|
||||
}
|
||||
lappend options "compiler=$G77_UNDER_TEST"
|
||||
return [target_compile $source $dest $type $options]
|
||||
}
|
||||
|
||||
#
|
||||
# g77_pass -- utility to record a testcase passed
|
||||
#
|
||||
|
||||
proc g77_pass { testcase cflags } {
|
||||
if { "$cflags" == "" } {
|
||||
pass "$testcase"
|
||||
} else {
|
||||
pass "$testcase, $cflags"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# g77_fail -- utility to record a testcase failed
|
||||
#
|
||||
|
||||
proc g77_fail { testcase cflags } {
|
||||
if { "$cflags" == "" } {
|
||||
fail "$testcase"
|
||||
} else {
|
||||
fail "$testcase, $cflags"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# g77_finish -- called at the end of every .exp script that calls g77_init
|
||||
#
|
||||
# The purpose of this proc is to hide all quirks of the testing environment
|
||||
# from the testsuites. It also exists to undo anything that g77_init did
|
||||
# (that needs undoing).
|
||||
#
|
||||
|
||||
proc g77_finish { } {
|
||||
# The testing harness apparently requires this.
|
||||
global errorInfo;
|
||||
|
||||
if [info exists errorInfo] then {
|
||||
unset errorInfo
|
||||
}
|
||||
|
||||
# Might as well reset these (keeps our caller from wondering whether
|
||||
# s/he has to or not).
|
||||
global prms_id bug_id
|
||||
set prms_id 0
|
||||
set bug_id 0
|
||||
}
|
||||
|
||||
proc g77_exit { } {
|
||||
global gluefile;
|
||||
|
||||
if [info exists gluefile] {
|
||||
file_on_build delete $gluefile;
|
||||
unset gluefile;
|
||||
}
|
||||
}
|
||||
|
||||
# If this is an older version of dejagnu (without runtest_file_p),
|
||||
# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
|
||||
# This can be deleted after next dejagnu release.
|
||||
|
||||
if { [info procs runtest_file_p] == "" } then {
|
||||
proc runtest_file_p { runtests testcase } {
|
||||
if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
|
||||
if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
# Provide a definition of this if missing (delete after next dejagnu release).
|
||||
|
||||
if { [info procs prune_warnings] == "" } then {
|
||||
proc prune_warnings { text } {
|
||||
return $text
|
||||
}
|
||||
}
|
||||
|
||||
# Utility used by mike-gcc.exp and c-torture.exp.
|
||||
# Check the compiler(/assembler/linker) output for text indicating that
|
||||
# the testcase should be marked as "unsupported".
|
||||
#
|
||||
# When dealing with a large number of tests, it's difficult to weed out the
|
||||
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
|
||||
# of memory). There are various ways to deal with this. Here's one.
|
||||
# Fortunately, all of the cases where this is likely to happen will be using
|
||||
# gld so we can tell what the error text will look like.
|
||||
|
||||
proc ${tool}_check_unsupported_p { output } {
|
||||
if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
|
||||
return "memory full"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Prune messages from g77 that aren't useful.
|
||||
|
||||
proc prune_g77_output { text } {
|
||||
#send_user "Before:$text\n"
|
||||
regsub -all "(^|\n)\[^\n\]*: In (function|method) \[^\n\]*" $text "" text
|
||||
regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $text "" text
|
||||
|
||||
# It would be nice to avoid passing anything to g77 that would cause it to
|
||||
# issue these messages (since ignoring them seems like a hack on our part),
|
||||
# but that's too difficult in the general case. For example, sometimes
|
||||
# you need to use -B to point g77 at crt0.o, but there are some targets
|
||||
# that don't have crt0.o.
|
||||
regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
|
||||
regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
|
||||
|
||||
#send_user "After:$text\n"
|
||||
|
||||
return $text
|
||||
}
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
# Copyright (C) 1988, 90, 91, 92, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This file was written by Mike Stump <mrs@cygnus.com>
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-g++@prep.ai.mit.edu
|
||||
|
||||
#
|
||||
# mike_cleanup -- remove any files that are created by the testcase
|
||||
#
|
||||
proc mike_cleanup { src_code output_file assembly_file } {
|
||||
remote_file build delete $output_file $assembly_file;
|
||||
}
|
||||
|
||||
#
|
||||
# prebase -- sets up a Mike Stump (mrs@cygnus.com) style G++ test
|
||||
#
|
||||
proc prebase { } {
|
||||
global compiler_output
|
||||
global not_compiler_output
|
||||
global compiler_result
|
||||
global not_compiler_result
|
||||
global program_output
|
||||
global groups
|
||||
global run
|
||||
global actions
|
||||
global target_regexp
|
||||
|
||||
set compiler_output "^$"
|
||||
set not_compiler_output ".*Internal compiler error.*"
|
||||
set compiler_result ""
|
||||
set not_compiler_result ""
|
||||
set program_output ".*PASS.*"
|
||||
set groups {}
|
||||
set run no
|
||||
set actions assemble
|
||||
set target_regexp ".*"
|
||||
}
|
||||
|
||||
#
|
||||
# run the test
|
||||
#
|
||||
proc postbase { src_code run groups args } {
|
||||
global verbose
|
||||
global srcdir
|
||||
global subdir
|
||||
global not_compiler_output
|
||||
global compiler_output
|
||||
global compiler_result
|
||||
global not_compiler_result
|
||||
global program_output
|
||||
global actions
|
||||
global target_regexp
|
||||
global host_triplet
|
||||
global target_triplet
|
||||
global tool
|
||||
global tmpdir
|
||||
global objdir
|
||||
global base_dir
|
||||
|
||||
if ![regexp $target_regexp $target_triplet] {
|
||||
unsupported $subdir/$src_code
|
||||
return
|
||||
}
|
||||
|
||||
if { [llength $args] > 0 } {
|
||||
set comp_options [lindex $args 0];
|
||||
} else {
|
||||
set comp_options ""
|
||||
}
|
||||
|
||||
set fail_message $subdir/$src_code
|
||||
set pass_message $subdir/$src_code
|
||||
|
||||
if [info exists GROUP] {
|
||||
if {[lsearch $groups $GROUP] == -1} {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if [string match $run yes] {
|
||||
set actions run
|
||||
}
|
||||
|
||||
set output_file "$tmpdir/[file tail [file rootname $src_code]]"
|
||||
set assembly_file "$output_file"
|
||||
append assembly_file ".S"
|
||||
|
||||
set compile_type "none"
|
||||
|
||||
case $actions {
|
||||
compile
|
||||
{
|
||||
set compile_type "assembly";
|
||||
set output_file $assembly_file;
|
||||
}
|
||||
assemble
|
||||
{
|
||||
set compile_type "object";
|
||||
append output_file ".o";
|
||||
}
|
||||
link
|
||||
{
|
||||
set compile_type "executable";
|
||||
set output_file "$tmpdir/a.out";
|
||||
}
|
||||
run
|
||||
{
|
||||
set compile_type "executable";
|
||||
set output_file "$tmpdir/a.out";
|
||||
set run yes;
|
||||
}
|
||||
default
|
||||
{
|
||||
set output_file "";
|
||||
set compile_type "none";
|
||||
}
|
||||
}
|
||||
|
||||
set src_file "$srcdir/$subdir/$src_code"
|
||||
set options ""
|
||||
|
||||
if { $comp_options != "" } {
|
||||
lappend options "additional_flags=$comp_options"
|
||||
}
|
||||
|
||||
if ![ishost "*-dos-*"] {
|
||||
lappend options "libs=-lstdc++ -lg++"
|
||||
} else {
|
||||
lappend options "libs=-lstdcxx -lgxx"
|
||||
}
|
||||
|
||||
set comp_output [g++_target_compile $src_file $output_file $compile_type $options]
|
||||
|
||||
set pass no
|
||||
|
||||
# Delete things like "ld.so warning" messages.
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
if [regexp -- $not_compiler_output $comp_output] {
|
||||
if { $verbose > 1 } {
|
||||
send_user "\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"
|
||||
} else {
|
||||
send_log "\nCompiler output:\n$comp_output\n\n"
|
||||
}
|
||||
fail $fail_message
|
||||
# The framework doesn't like to see any error remnants,
|
||||
# so remove them.
|
||||
uplevel {
|
||||
if [info exists errorInfo] {
|
||||
unset errorInfo
|
||||
}
|
||||
}
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
return
|
||||
}
|
||||
|
||||
# remove any leftover CRs.
|
||||
regsub -all -- "\r" $comp_output "" comp_output
|
||||
|
||||
regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
|
||||
regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
|
||||
|
||||
set unsupported_message [${tool}_check_unsupported_p $comp_output]
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$subdir/$src_code: $unsupported_message"
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
return
|
||||
}
|
||||
|
||||
if { $verbose > 1 } {
|
||||
send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"
|
||||
} else {
|
||||
send_log "\nCompiler output:\n$comp_output\n\n"
|
||||
}
|
||||
if [regexp -- $compiler_output $comp_output] {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Yes, it matches.\n\n"
|
||||
}
|
||||
set pass yes
|
||||
if [file exists [file rootname [file tail $src_code]].s] {
|
||||
set fd [open [file rootname [file tail $src_code]].s r]
|
||||
set dot_s [read $fd]
|
||||
close $fd
|
||||
if { $compiler_result != "" } {
|
||||
verbose "Checking .s file for $compiler_result" 2
|
||||
if [regexp -- $compiler_result $dot_s] {
|
||||
verbose "Yes, it matches." 2
|
||||
} else {
|
||||
verbose "Nope, doesn't match." 2
|
||||
verbose $dot_s 4
|
||||
set pass no
|
||||
}
|
||||
}
|
||||
if { $not_compiler_result != "" } {
|
||||
verbose "Checking .s file for not $not_compiler_result" 2
|
||||
if ![regexp -- $not_compiler_result $dot_s] {
|
||||
verbose "Nope, not found (that's good)." 2
|
||||
} else {
|
||||
verbose "Uh oh, it was found." 2
|
||||
verbose $dot_s 4
|
||||
set pass no
|
||||
}
|
||||
}
|
||||
}
|
||||
if [string match $run yes] {
|
||||
set result [g++_load $output_file]
|
||||
set status [lindex $result 0];
|
||||
set output [lindex $result 1];
|
||||
|
||||
if { $status == -1 } {
|
||||
mike_cleanup $src_code $output_file $assembly_file;
|
||||
return;
|
||||
}
|
||||
if { $verbose > 1 } {
|
||||
send_user "Checking:\n$program_output\nto see if it matches:\n$output\n\n"
|
||||
}
|
||||
if ![regexp -- $program_output $output] {
|
||||
set pass no
|
||||
if { $verbose > 1 } {
|
||||
send_user "Nope, does not match.\n\n"
|
||||
}
|
||||
} else {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Yes, it matches.\n\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Nope, does not match.\n\n"
|
||||
}
|
||||
}
|
||||
|
||||
if [string match $pass "yes"] {
|
||||
pass $pass_message
|
||||
} else {
|
||||
fail $fail_message
|
||||
}
|
||||
|
||||
# The framework doesn't like to see any error remnants,
|
||||
# so remove them.
|
||||
uplevel {
|
||||
if [info exists errorInfo] {
|
||||
unset errorInfo
|
||||
}
|
||||
}
|
||||
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
# Copyright (C) 1988, 90, 91, 92, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This file was derived from mike-g++.exp written by Mike Stump <mrs@cygnus.com>
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# fortran@gnu.org
|
||||
|
||||
#
|
||||
# mike_cleanup -- remove any files that are created by the testcase
|
||||
#
|
||||
proc mike_cleanup { src_code output_file assembly_file } {
|
||||
remote_file build delete $output_file $assembly_file;
|
||||
}
|
||||
|
||||
#
|
||||
# prebase -- sets up a Mike Stump (mrs@cygnus.com) style g77 test
|
||||
#
|
||||
proc prebase { } {
|
||||
global compiler_output
|
||||
global not_compiler_output
|
||||
global compiler_result
|
||||
global not_compiler_result
|
||||
global program_output
|
||||
global groups
|
||||
global run
|
||||
global actions
|
||||
global target_regexp
|
||||
|
||||
set compiler_output "^$"
|
||||
set not_compiler_output ".*Internal compiler error.*"
|
||||
set compiler_result ""
|
||||
set not_compiler_result ""
|
||||
set program_output ".*PASS.*"
|
||||
set groups {}
|
||||
set run no
|
||||
set actions assemble
|
||||
set target_regexp ".*"
|
||||
}
|
||||
|
||||
#
|
||||
# run the test
|
||||
#
|
||||
proc postbase { src_code run groups args } {
|
||||
global verbose
|
||||
global srcdir
|
||||
global subdir
|
||||
global not_compiler_output
|
||||
global compiler_output
|
||||
global compiler_result
|
||||
global not_compiler_result
|
||||
global program_output
|
||||
global actions
|
||||
global target_regexp
|
||||
global host_triplet
|
||||
global target_triplet
|
||||
global tool
|
||||
global tmpdir
|
||||
global G77_UNDER_TEST
|
||||
global GROUP
|
||||
|
||||
if ![info exists G77_UNDER_TEST] {
|
||||
error "No compiler specified for testing."
|
||||
}
|
||||
|
||||
if ![regexp $target_regexp $target_triplet] {
|
||||
unsupported $subdir/$src_code
|
||||
return
|
||||
}
|
||||
|
||||
if { [llength $args] > 0 } {
|
||||
set comp_options [lindex $args 0];
|
||||
} else {
|
||||
set comp_options ""
|
||||
}
|
||||
|
||||
set fail_message $subdir/$src_code
|
||||
set pass_message $subdir/$src_code
|
||||
|
||||
if [info exists GROUP] {
|
||||
if {[lsearch $groups $GROUP] == -1} {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if [string match $run yes] {
|
||||
set actions run
|
||||
}
|
||||
|
||||
set output_file "$tmpdir/[file tail [file rootname $src_code]]"
|
||||
set assembly_file "$output_file"
|
||||
append assembly_file ".S"
|
||||
|
||||
set compile_type "none"
|
||||
|
||||
case $actions {
|
||||
compile
|
||||
{
|
||||
set compile_type "assembly";
|
||||
set output_file $assembly_file;
|
||||
}
|
||||
assemble
|
||||
{
|
||||
set compile_type "object";
|
||||
append output_file ".o";
|
||||
}
|
||||
link
|
||||
{
|
||||
set compile_type "executable";
|
||||
set output_file "$tmpdir/a.out";
|
||||
}
|
||||
run
|
||||
{
|
||||
set compile_type "executable";
|
||||
set output_file "$tmpdir/a.out";
|
||||
set run yes;
|
||||
}
|
||||
default
|
||||
{
|
||||
set output_file "";
|
||||
set compile_type "none";
|
||||
}
|
||||
}
|
||||
|
||||
set src_file "$srcdir/$subdir/$src_code"
|
||||
set options ""
|
||||
lappend options "compiler=$G77_UNDER_TEST"
|
||||
|
||||
if { $comp_options != "" } {
|
||||
lappend options "additional_flags=$comp_options"
|
||||
}
|
||||
|
||||
set comp_output [g77_target_compile $src_file $output_file $compile_type $options];
|
||||
|
||||
set pass no
|
||||
|
||||
# Delete things like "ld.so warning" messages.
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
if [regexp -- $not_compiler_output $comp_output] {
|
||||
if { $verbose > 1 } {
|
||||
send_user "\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"
|
||||
} else {
|
||||
send_log "\nCompiler output:\n$comp_output\n\n"
|
||||
}
|
||||
fail $fail_message
|
||||
# The framework doesn't like to see any error remnants,
|
||||
# so remove them.
|
||||
uplevel {
|
||||
if [info exists errorInfo] {
|
||||
unset errorInfo
|
||||
}
|
||||
}
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
return
|
||||
}
|
||||
|
||||
# remove any leftover CRs.
|
||||
regsub -all -- "\r" $comp_output "" comp_output
|
||||
|
||||
regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
|
||||
regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
|
||||
|
||||
set unsupported_message [${tool}_check_unsupported_p $comp_output]
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$subdir/$src_code: $unsupported_message"
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
return
|
||||
}
|
||||
|
||||
if { $verbose > 1 } {
|
||||
send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"
|
||||
} else {
|
||||
send_log "\nCompiler output:\n$comp_output\n\n"
|
||||
}
|
||||
if [regexp -- $compiler_output $comp_output] {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Yes, it matches.\n\n"
|
||||
}
|
||||
set pass yes
|
||||
if [file exists [file rootname [file tail $src_code]].s] {
|
||||
set fd [open [file rootname [file tail $src_code]].s r]
|
||||
set dot_s [read $fd]
|
||||
close $fd
|
||||
if { $compiler_result != "" } {
|
||||
verbose "Checking .s file for $compiler_result" 2
|
||||
if [regexp -- $compiler_result $dot_s] {
|
||||
verbose "Yes, it matches." 2
|
||||
} else {
|
||||
verbose "Nope, doesn't match." 2
|
||||
verbose $dot_s 4
|
||||
set pass no
|
||||
}
|
||||
}
|
||||
if { $not_compiler_result != "" } {
|
||||
verbose "Checking .s file for not $not_compiler_result" 2
|
||||
if ![regexp -- $not_compiler_result $dot_s] {
|
||||
verbose "Nope, not found (that's good)." 2
|
||||
} else {
|
||||
verbose "Uh oh, it was found." 2
|
||||
verbose $dot_s 4
|
||||
set pass no
|
||||
}
|
||||
}
|
||||
}
|
||||
if [string match $run yes] {
|
||||
set result [g77_load $output_file]
|
||||
set status [lindex $result 0];
|
||||
set output [lindex $result 1];
|
||||
if { $status == -1 } {
|
||||
mike_cleanup $src_code $output_file $assembly_file;
|
||||
return;
|
||||
}
|
||||
if { $verbose > 1 } {
|
||||
send_user "Checking:\n$program_output\nto see if it matches:\n$output\n\n"
|
||||
}
|
||||
if ![regexp -- $program_output $output] {
|
||||
set pass no
|
||||
if { $verbose > 1 } {
|
||||
send_user "Nope, does not match.\n\n"
|
||||
}
|
||||
} else {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Yes, it matches.\n\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { $verbose > 1 } {
|
||||
send_user "Nope, does not match.\n\n"
|
||||
}
|
||||
}
|
||||
|
||||
if [string match $pass "yes"] {
|
||||
pass $pass_message
|
||||
} else {
|
||||
fail $fail_message
|
||||
}
|
||||
|
||||
# The framework doesn't like to see any error remnants,
|
||||
# so remove them.
|
||||
uplevel {
|
||||
if [info exists errorInfo] {
|
||||
unset errorInfo
|
||||
}
|
||||
}
|
||||
|
||||
mike_cleanup $src_code $output_file $assembly_file
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu.prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye. (rob@cygnus.com)
|
||||
|
||||
# The default option list can be overridden by
|
||||
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
|
||||
|
||||
if ![info exists TORTURE_OPTIONS] {
|
||||
# FIXME: We should test -g at least once.
|
||||
set TORTURE_OPTIONS [list { -O }]
|
||||
}
|
||||
|
||||
|
||||
# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
|
||||
# one for testcases without loops.
|
||||
|
||||
set torture_with_loops $TORTURE_OPTIONS
|
||||
set torture_without_loops ""
|
||||
foreach option $TORTURE_OPTIONS {
|
||||
if ![string match "*loop*" $option] {
|
||||
lappend torture_without_loops $option
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# objc-torture-compile -- runs the Tege C-torture test
|
||||
#
|
||||
# SRC is the full pathname of the testcase.
|
||||
# OPTION is the specific compiler flag we're testing (eg: -O2).
|
||||
#
|
||||
proc objc-torture-compile { src option } {
|
||||
global output
|
||||
global srcdir tmpdir
|
||||
global host_triplet
|
||||
|
||||
set output "$tmpdir/[file tail [file rootname $src]].o"
|
||||
|
||||
regsub "^$srcdir/?" $src "" testcase
|
||||
# If we couldn't rip $srcdir out of `src' then just do the best we can.
|
||||
# The point is to reduce the unnecessary noise in the logs. Don't strip
|
||||
# out too much because different testcases with the same name can confuse
|
||||
# `test-tool'.
|
||||
if [string match "/*" $testcase] {
|
||||
set testcase "[file tail [file dirname $src]]/[file tail $src]"
|
||||
}
|
||||
|
||||
verbose "Testing $testcase, $option" 1
|
||||
|
||||
# Run the compiler and analyze the results.
|
||||
set options ""
|
||||
lappend options "additional_flags=-w $option"
|
||||
|
||||
set comp_output [objc_target_compile "$src" "$output" object $options];
|
||||
|
||||
# Set a few common compiler messages.
|
||||
set fatal_signal "*77*: Internal compiler error: program*got fatal signal"
|
||||
|
||||
if [string match "$fatal_signal 6" $comp_output] then {
|
||||
objc_fail $testcase "Got Signal 6, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
if [string match "$fatal_signal 11" $comp_output] then {
|
||||
objc_fail $testcase "Got Signal 11, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
# We shouldn't get these because of -w, but just in case.
|
||||
if [string match "*77*:*warning:*" $comp_output] then {
|
||||
warning "$testcase: (with warnings) $option"
|
||||
send_log "$comp_output\n"
|
||||
unresolved "$testcase, $option"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
set unsupported_message [objc_check_unsupported_p $comp_output]
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$testcase: $unsupported_message"
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
# remove any leftover LF/CR to make sure any output is legit
|
||||
regsub -all -- "\[\r\n\]*" $comp_output "" comp_output
|
||||
# If any message remains, we fail.
|
||||
if ![string match "" $comp_output] then {
|
||||
objc_fail $testcase $option
|
||||
remote_file build delete $output
|
||||
return
|
||||
}
|
||||
|
||||
objc_pass $testcase $option
|
||||
remote_file build delete $output
|
||||
}
|
||||
|
||||
#
|
||||
# objc-torture-execute -- utility to compile and execute a testcase
|
||||
#
|
||||
# SRC is the full pathname of the testcase.
|
||||
#
|
||||
# If the testcase has an associated .cexp file, we source that to run the
|
||||
# test instead. We use .cexp instead of .exp so that the testcase is still
|
||||
# controlled by the main .exp driver (this is useful when one wants to only
|
||||
# run the compile.exp tests for example - one need only pass compile.exp to
|
||||
# dejagnu, and not compile.exp, foo1.exp, foo2.exp, etc.).
|
||||
#
|
||||
proc objc-torture-execute { src } {
|
||||
global tmpdir tool srcdir output
|
||||
|
||||
# Check for alternate driver.
|
||||
if [file exists [file rootname $src].cexp] {
|
||||
verbose "Using alternate driver [file rootname [file tail $src]].cexp" 2
|
||||
set done_p 0
|
||||
catch "set done_p \[source [file rootname $src].cexp\]"
|
||||
if { $done_p } {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Look for a loop within the source code - if we don't find one,
|
||||
# don't pass -funroll[-all]-loops.
|
||||
global torture_with_loops torture_without_loops
|
||||
if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
|
||||
set option_list $torture_with_loops
|
||||
} else {
|
||||
set option_list $torture_without_loops
|
||||
}
|
||||
|
||||
set executable $tmpdir/[file tail [file rootname $src].x]
|
||||
|
||||
regsub "^$srcdir/?" $src "" testcase
|
||||
# If we couldn't rip $srcdir out of `src' then just do the best we can.
|
||||
# The point is to reduce the unnecessary noise in the logs. Don't strip
|
||||
# out too much because different testcases with the same name can confuse
|
||||
# `test-tool'.
|
||||
if [string match "/*" $testcase] {
|
||||
set testcase "[file tail [file dirname $src]]/[file tail $src]"
|
||||
}
|
||||
|
||||
foreach option $option_list {
|
||||
# torture_{compile,execute}_xfail are set by the .cexp script
|
||||
# (if present)
|
||||
if [info exists torture_compile_xfail] {
|
||||
setup_xfail $torture_compile_xfail
|
||||
}
|
||||
remote_file build delete $executable
|
||||
verbose "Testing $testcase, $option" 1
|
||||
|
||||
set options ""
|
||||
lappend options "additional_flags=-w $option -I${srcdir}/../../libobjc"
|
||||
set comp_output [objc_target_compile "$src" "$executable" executable $options];
|
||||
|
||||
# Set a few common compiler messages.
|
||||
set fatal_signal "*77*: Internal compiler error: program*got fatal signal"
|
||||
|
||||
if [string match "$fatal_signal 6" $comp_output] then {
|
||||
objc_fail $testcase "Got Signal 6, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
if [string match "$fatal_signal 11" $comp_output] then {
|
||||
objc_fail $testcase "Got Signal 11, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
# We shouldn't get these because of -w, but just in case.
|
||||
if [string match "*77*:*warning:*" $comp_output] then {
|
||||
warning "$testcase: (with warnings) $option"
|
||||
send_log "$comp_output\n"
|
||||
unresolved "$testcase, $option"
|
||||
remote_file build delete $executable
|
||||
continue
|
||||
}
|
||||
|
||||
set comp_output [prune_warnings $comp_output]
|
||||
|
||||
set unsupported_message [objc_check_unsupported_p $comp_output]
|
||||
|
||||
if { $unsupported_message != "" } {
|
||||
unsupported "$testcase: $unsupported_message"
|
||||
continue
|
||||
} elseif ![file exists $executable] {
|
||||
if ![is3way] {
|
||||
fail "$testcase compilation, $option"
|
||||
untested "$testcase execution, $option"
|
||||
continue
|
||||
} else {
|
||||
# FIXME: since we can't test for the existance of a remote
|
||||
# file without short of doing an remote file list, we assume
|
||||
# that since we got no output, it must have compiled.
|
||||
pass "$testcase compilation, $option"
|
||||
}
|
||||
} else {
|
||||
pass "$testcase compilation, $option"
|
||||
}
|
||||
|
||||
# See if this source file uses "long long" types, if it does, and
|
||||
# no_long_long is set, skip execution of the test.
|
||||
if [target_info exists no_long_long] then {
|
||||
if [expr [search_for $src "integer\*8"]] then {
|
||||
untested "$testcase execution, $option"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists torture_execute_xfail] {
|
||||
setup_xfail $torture_execute_xfail
|
||||
}
|
||||
|
||||
set result [objc_load "$executable" "" ""]
|
||||
set status [lindex $result 0];
|
||||
set output [lindex $result 1];
|
||||
if { $status == "pass" } {
|
||||
remote_file build delete $executable
|
||||
}
|
||||
$status "$testcase execution, $option"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# search_for -- looks for a string match in a file
|
||||
#
|
||||
proc search_for { file pattern } {
|
||||
set fd [open $file r]
|
||||
while { [gets $fd cur_line]>=0 } {
|
||||
set lower [string tolower $cur_line]
|
||||
if [regexp "$pattern" $lower] then {
|
||||
close $fd
|
||||
return 1
|
||||
}
|
||||
}
|
||||
close $fd
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# objc-torture -- the objc-torture testcase source file processor
|
||||
#
|
||||
# This runs compilation only tests (no execute tests).
|
||||
# SRC is the full pathname of the testcase, or just a file name in which case
|
||||
# we prepend $srcdir/$subdir.
|
||||
#
|
||||
# If the testcase has an associated .cexp file, we source that to run the
|
||||
# test instead. We use .cexp instead of .exp so that the testcase is still
|
||||
# controlled by the main .exp driver (this is useful when one wants to only
|
||||
# run the compile.exp tests for example - one need only pass compile.exp to
|
||||
# dejagnu, and not compile.exp, foo1.exp, foo2.exp, etc.).
|
||||
#
|
||||
proc objc-torture { args } {
|
||||
global srcdir subdir
|
||||
|
||||
set src [lindex $args 0];
|
||||
if { [llength $args] > 1 } {
|
||||
set options [lindex $args 1];
|
||||
} else {
|
||||
set options ""
|
||||
}
|
||||
|
||||
# Prepend $srdir/$subdir if missing.
|
||||
if ![string match "*/*" $src] {
|
||||
set src "$srcdir/$subdir/$src"
|
||||
}
|
||||
|
||||
# Check for alternate driver.
|
||||
if [file exists [file rootname $src].cexp] {
|
||||
verbose "Using alternate driver [file rootname [file tail $src]].cexp" 2
|
||||
set done_p 0
|
||||
catch "set done_p \[source [file rootname $src].cexp\]"
|
||||
if { $done_p } {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Look for a loop within the source code - if we don't find one,
|
||||
# don't pass -funroll[-all]-loops.
|
||||
global torture_with_loops torture_without_loops
|
||||
if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
|
||||
set option_list $torture_with_loops
|
||||
} else {
|
||||
set option_list $torture_without_loops
|
||||
}
|
||||
|
||||
# loop through all the options
|
||||
foreach option $option_list {
|
||||
# torture_compile_xfail is set by the .cexp script (if present)
|
||||
if [info exists torture_compile_xfail] {
|
||||
setup_xfail $torture_compile_xfail
|
||||
}
|
||||
|
||||
objc-torture-compile $src "$option $options"
|
||||
}
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# This file was written by Rob Savoye (rob@cygnus.com)
|
||||
# Currently maintained by Doug Evans (dje@cygnus.com)
|
||||
|
||||
# This file is loaded by the tool init file (eg: unix.exp). It provides
|
||||
# default definitions for objc_start, etc. and other supporting cast members.
|
||||
|
||||
# These globals are used by objc_start if no compiler arguments are provided.
|
||||
# They are also used by the various testsuites to define the environment:
|
||||
# where to find stdio.h, libc.a, etc.
|
||||
|
||||
#
|
||||
# OBJC_UNDER_TEST is the compiler under test.
|
||||
#
|
||||
|
||||
#
|
||||
# default_objc_version -- extract and print the version number of the compiler
|
||||
#
|
||||
|
||||
proc default_objc_version { } {
|
||||
global OBJC_UNDER_TEST
|
||||
|
||||
objc_init;
|
||||
|
||||
# ignore any arguments after the command
|
||||
set compiler [lindex $OBJC_UNDER_TEST 0]
|
||||
|
||||
if ![is_remote host] {
|
||||
set compiler_name [which $compiler];
|
||||
} else {
|
||||
set compiler_name $compiler;
|
||||
}
|
||||
|
||||
# verify that the compiler exists
|
||||
if { $compiler_name != 0 } then {
|
||||
set tmp [remote_exec host "$compiler -v"]
|
||||
set status [lindex $tmp 0];
|
||||
set output [lindex $tmp 1];
|
||||
regexp "version.*$" $output version
|
||||
if { $status == 0 && [info exists version] } then {
|
||||
clone_output "$compiler_name $version\n"
|
||||
} else {
|
||||
clone_output "Couldn't determine version of $compiler_name: $output\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Call objc_version. We do it this way so we can override it if needed.
|
||||
#
|
||||
proc objc_version { } {
|
||||
default_objc_version;
|
||||
}
|
||||
|
||||
#
|
||||
# objc_init -- called at the start of each .exp script.
|
||||
#
|
||||
# There currently isn't much to do, but always using it allows us to
|
||||
# make some enhancements without having to go back and rewrite the scripts.
|
||||
#
|
||||
|
||||
set objc_initialized 0
|
||||
|
||||
proc objc_init { args } {
|
||||
global tmpdir
|
||||
global libdir
|
||||
global gluefile wrap_flags
|
||||
global objc_initialized
|
||||
global OBJC_UNDER_TEST
|
||||
global TOOL_EXECUTABLE
|
||||
|
||||
if { $objc_initialized == 1 } { return; }
|
||||
|
||||
if ![info exists OBJC_UNDER_TEST] then {
|
||||
if [info exists TOOL_EXECUTABLE] {
|
||||
set OBJC_UNDER_TEST $TOOL_EXECUTABLE;
|
||||
} else {
|
||||
set OBJC_UNDER_TEST [find_gcc]
|
||||
}
|
||||
}
|
||||
|
||||
if ![info exists tmpdir] then {
|
||||
set tmpdir /tmp
|
||||
}
|
||||
if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } {
|
||||
set gluefile ${tmpdir}/testglue.o;
|
||||
set result [build_wrapper $gluefile];
|
||||
if { $result != "" } {
|
||||
set gluefile [lindex $result 0];
|
||||
set wrap_flags [lindex $result 1];
|
||||
} else {
|
||||
unset gluefile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc objc_target_compile { source dest type options } {
|
||||
global tmpdir;
|
||||
global gluefile wrap_flags;
|
||||
global OBJC_UNDER_TEST
|
||||
global TOOL_OPTIONS
|
||||
|
||||
lappend options "libs=-lobjc"
|
||||
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
lappend options "ldflags=$wrap_flags"
|
||||
}
|
||||
|
||||
if [target_info exists objc,stack_size] {
|
||||
lappend options "additional_flags=-DSTACK_SIZE=[target_info objc,stack_size]"
|
||||
}
|
||||
if [target_info exists objc,no_trampolines] {
|
||||
lappend options "additional_flags=-DNO_TRAMPOLINES"
|
||||
}
|
||||
if [target_info exists objc,no_label_values] {
|
||||
lappend options "additional_flags=-DNO_LABEL_VALUES"
|
||||
}
|
||||
if [info exists TOOL_OPTIONS] {
|
||||
lappend options "additional_flags=$TOOL_OPTIONS"
|
||||
}
|
||||
if [target_info exists objc,no_varargs] {
|
||||
lappend options "additional_flags=-DNO_VARARGS"
|
||||
}
|
||||
set objcpath "[get_multilibs]"
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/libobjc.a]
|
||||
if { $libobjc_dir != "" } {
|
||||
set objc_link_flags "-L[file dirname ${libobjc_dir}]"
|
||||
lappend options "additional_flags=${objc_link_flags}"
|
||||
}
|
||||
lappend options "compiler=$OBJC_UNDER_TEST"
|
||||
return [target_compile $source $dest $type $options]
|
||||
}
|
||||
|
||||
#
|
||||
# objc_pass -- utility to record a testcase passed
|
||||
#
|
||||
|
||||
proc objc_pass { testcase cflags } {
|
||||
if { "$cflags" == "" } {
|
||||
pass "$testcase"
|
||||
} else {
|
||||
pass "$testcase, $cflags"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# objc_fail -- utility to record a testcase failed
|
||||
#
|
||||
|
||||
proc objc_fail { testcase cflags } {
|
||||
if { "$cflags" == "" } {
|
||||
fail "$testcase"
|
||||
} else {
|
||||
fail "$testcase, $cflags"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# objc_finish -- called at the end of every .exp script that calls objc_init
|
||||
#
|
||||
# The purpose of this proc is to hide all quirks of the testing environment
|
||||
# from the testsuites. It also exists to undo anything that objc_init did
|
||||
# (that needs undoing).
|
||||
#
|
||||
|
||||
proc objc_finish { } {
|
||||
# The testing harness apparently requires this.
|
||||
global errorInfo;
|
||||
|
||||
if [info exists errorInfo] then {
|
||||
unset errorInfo
|
||||
}
|
||||
|
||||
# Might as well reset these (keeps our caller from wondering whether
|
||||
# s/he has to or not).
|
||||
global prms_id bug_id
|
||||
set prms_id 0
|
||||
set bug_id 0
|
||||
}
|
||||
|
||||
proc objc_exit { } {
|
||||
global gluefile;
|
||||
|
||||
if [info exists gluefile] {
|
||||
file_on_build delete $gluefile;
|
||||
unset gluefile;
|
||||
}
|
||||
}
|
||||
|
||||
# If this is an older version of dejagnu (without runtest_file_p),
|
||||
# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c.
|
||||
# This can be deleted after next dejagnu release.
|
||||
|
||||
if { [info procs runtest_file_p] == "" } then {
|
||||
proc runtest_file_p { runtests testcase } {
|
||||
if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then {
|
||||
if { [lsearch $runtests [file tail $testcase]] >= 0 } then {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
# Provide a definition of this if missing (delete after next dejagnu release).
|
||||
|
||||
if { [info procs prune_warnings] == "" } then {
|
||||
proc prune_warnings { text } {
|
||||
return $text
|
||||
}
|
||||
}
|
||||
|
||||
# Utility used by mike-gcc.exp and c-torture.exp.
|
||||
# Check the compiler(/assembler/linker) output for text indicating that
|
||||
# the testcase should be marked as "unsupported".
|
||||
#
|
||||
# When dealing with a large number of tests, it's difficult to weed out the
|
||||
# ones that are too big for a particular cpu (eg: 16 bit with a small amount
|
||||
# of memory). There are various ways to deal with this. Here's one.
|
||||
# Fortunately, all of the cases where this is likely to happen will be using
|
||||
# gld so we can tell what the error text will look like.
|
||||
|
||||
proc ${tool}_check_unsupported_p { output } {
|
||||
if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
|
||||
return "memory full"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Prune messages from objc that aren't useful.
|
||||
|
||||
proc prune_objc_output { text } {
|
||||
#send_user "Before:$text\n"
|
||||
regsub -all "(^|\n)\[^\n\]*: In (function|method) \[^\n\]*" $text "" text
|
||||
regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $text "" text
|
||||
|
||||
# It would be nice to avoid passing anything to objc that would cause it to
|
||||
# issue these messages (since ignoring them seems like a hack on our part),
|
||||
# but that's too difficult in the general case. For example, sometimes
|
||||
# you need to use -B to point objc at crt0.o, but there are some targets
|
||||
# that don't have crt0.o.
|
||||
regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
|
||||
regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
|
||||
|
||||
#send_user "After:$text\n"
|
||||
|
||||
return $text
|
||||
}
|
||||
|
||||
66
gcc/toplev.c
66
gcc/toplev.c
@@ -82,6 +82,8 @@ extern char *version_string, *language_string;
|
||||
extern int size_directive_output;
|
||||
extern tree last_assemble_variable_decl;
|
||||
|
||||
extern void cpplib_init();
|
||||
|
||||
extern char *init_parse PVPROTO((char *));
|
||||
extern void finish_parse ();
|
||||
extern void init_decl_processing ();
|
||||
@@ -135,9 +137,6 @@ static void vsorry PROTO((char *, va_list));
|
||||
static void v_really_sorry PROTO((char *, va_list)) ATTRIBUTE_NORETURN;
|
||||
static void float_signal PROTO((int)) ATTRIBUTE_NORETURN;
|
||||
static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN;
|
||||
#ifdef ASM_IDENTIFY_LANGUAGE
|
||||
static void output_lang_identify PROTO((FILE *));
|
||||
#endif
|
||||
static void open_dump_file PROTO((char *, char *));
|
||||
static void close_dump_file PROTO((void (*) (FILE *, rtx), rtx));
|
||||
static void dump_rtl PROTO((char *, tree, void (*) (FILE *, rtx), rtx));
|
||||
@@ -1029,28 +1028,7 @@ documented_lang_options[] =
|
||||
{ "-nostdinc", "" },
|
||||
{ "-nostdinc++", "" },
|
||||
{ "-trigraphs", "" },
|
||||
{ "-undef", "" },
|
||||
|
||||
#define DEFINE_LANG_NAME(NAME) { NULL, NAME },
|
||||
|
||||
/* These are for obj c. */
|
||||
DEFINE_LANG_NAME ("Objective C")
|
||||
|
||||
{ "-lang-objc", "" },
|
||||
{ "-gen-decls", "Dump decls to a .decl file" },
|
||||
{ "-fgnu-runtime", "Generate code for GNU runtime envrionment" },
|
||||
{ "-fno-gnu-runtime", "" },
|
||||
{ "-fnext-runtime", "Generate code for NeXT runtime environment" },
|
||||
{ "-fno-next-runtime", "" },
|
||||
{ "-Wselector", "Warn if a selector has multiple methods" },
|
||||
{ "-Wno-selector", "" },
|
||||
{ "-Wprotocol", "" },
|
||||
{ "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
|
||||
{ "-print-objc-runtime-info",
|
||||
"Generate C header of platform specific features" },
|
||||
|
||||
#include "options.h"
|
||||
|
||||
{ "-undef", "" }
|
||||
};
|
||||
|
||||
/* Here is a table, controlled by the tm.h file, listing each -m switch
|
||||
@@ -2372,19 +2350,6 @@ output_file_directive (asm_file, input_name)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ASM_IDENTIFY_LANGUAGE
|
||||
/* Routine to build language identifier for object file. */
|
||||
static void
|
||||
output_lang_identify (asm_out_file)
|
||||
FILE *asm_out_file;
|
||||
{
|
||||
int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
|
||||
char *s = (char *) alloca (len);
|
||||
sprintf (s, "__gnu_compiled_%s", lang_identify ());
|
||||
ASM_OUTPUT_LABEL (asm_out_file, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Routine to open a dump file. */
|
||||
static void
|
||||
@@ -2721,9 +2686,13 @@ compile_file (name)
|
||||
input_file_stack->next = 0;
|
||||
input_file_stack->name = input_filename;
|
||||
|
||||
/* Perform language-specific initialization.
|
||||
This may set main_input_filename. */
|
||||
lang_init ();
|
||||
/* This may set main_input_filename. */
|
||||
#if !USE_CPPLIB
|
||||
ungetc (check_newline (), finput);
|
||||
#else
|
||||
check_newline ();
|
||||
yy_cur--;
|
||||
#endif
|
||||
|
||||
/* If the input doesn't start with a #line, use the input name
|
||||
as the official input file name. */
|
||||
@@ -3002,9 +2971,6 @@ compile_file (name)
|
||||
|
||||
weak_finish ();
|
||||
|
||||
/* Do dbx symbols */
|
||||
|
||||
|
||||
#ifdef DWARF2_UNWIND_INFO
|
||||
if (dwarf2out_do_frame ())
|
||||
dwarf2out_frame_finish ();
|
||||
@@ -3026,10 +2992,7 @@ compile_file (name)
|
||||
ASM_FILE_END (asm_out_file);
|
||||
#endif
|
||||
|
||||
|
||||
/* Language-specific end of compilation actions. */
|
||||
finish_syntax:
|
||||
lang_finish ();
|
||||
|
||||
/* Close the dump files. */
|
||||
|
||||
@@ -4406,8 +4369,9 @@ main (argc, argv)
|
||||
flag_short_enums = DEFAULT_SHORT_ENUMS;
|
||||
#endif
|
||||
|
||||
/* Perform language-specific options intialization. */
|
||||
lang_init_options ();
|
||||
#if USE_CPPLIB
|
||||
cpplib_init();
|
||||
#endif
|
||||
|
||||
/* Scan to see what optimization level has been specified. That will
|
||||
determine the default value of many flags. */
|
||||
@@ -4517,9 +4481,7 @@ main (argc, argv)
|
||||
|
||||
if (j != (size_t)-1)
|
||||
{
|
||||
/* If the option is valid for *some* language,
|
||||
treat it as valid even if this language doesn't understand it. */
|
||||
int strings_processed = lang_decode_option (argc - i, argv + i);
|
||||
int strings_processed = c_decode_option (argc - i, argv + i);
|
||||
|
||||
if (!strcmp (argv[i], "--help"))
|
||||
{
|
||||
|
||||
@@ -4749,8 +4749,7 @@ print_obstack_statistics (str, o)
|
||||
str, n_alloc, n_chunks);
|
||||
}
|
||||
|
||||
/* Print debugging information about tree nodes generated during the compile,
|
||||
and any language-specific information. */
|
||||
/* Print debugging information about tree nodes generated during the compile. */
|
||||
|
||||
void
|
||||
dump_tree_statistics ()
|
||||
@@ -4785,7 +4784,6 @@ dump_tree_statistics ()
|
||||
print_obstack_statistics ("momentary_obstack", &momentary_obstack);
|
||||
print_obstack_statistics ("temp_decl_obstack", &temp_decl_obstack);
|
||||
print_inline_obstack_statistics ();
|
||||
print_lang_statistics ();
|
||||
}
|
||||
|
||||
#define FILE_FUNCTION_PREFIX_LEN 9
|
||||
|
||||
21
gcc/tree.h
21
gcc/tree.h
@@ -2036,31 +2036,16 @@ extern void dwarf2out_end_epilogue PROTO((void));
|
||||
|
||||
/* The language front-end must define these functions. */
|
||||
|
||||
/* Function of no arguments for initializing options. */
|
||||
extern void lang_init_options PROTO((void));
|
||||
|
||||
/* Function of no arguments for initializing lexical scanning. */
|
||||
extern void init_lex PROTO((void));
|
||||
/* Function of no arguments for initializing the symbol table. */
|
||||
extern void init_decl_processing PROTO((void));
|
||||
|
||||
/* Functions called with no arguments at the beginning and end or processing
|
||||
the input source file. */
|
||||
extern void lang_init PROTO((void));
|
||||
extern void lang_finish PROTO((void));
|
||||
|
||||
/* Function to identify which front-end produced the output file. */
|
||||
extern char *lang_identify PROTO((void));
|
||||
|
||||
/* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy. */
|
||||
extern void copy_lang_decl PROTO((tree));
|
||||
|
||||
/* Function called with no arguments to parse and compile the input. */
|
||||
extern int yyparse PROTO((void));
|
||||
/* Function called with option as argument
|
||||
to decode options starting with -f or -W or +.
|
||||
It should return nonzero if it handles the option. */
|
||||
extern int lang_decode_option PROTO((int, char **));
|
||||
|
||||
/* Functions for processing symbol declarations. */
|
||||
/* Function to enter a new lexical scope.
|
||||
@@ -2229,9 +2214,6 @@ extern struct rtx_def *emit_line_note_force PROTO ((char *, int));
|
||||
extern int mark_addressable PROTO ((tree));
|
||||
extern void incomplete_type_error PROTO ((tree, tree));
|
||||
|
||||
/* In c-lang.c */
|
||||
extern void print_lang_statistics PROTO ((void));
|
||||
|
||||
/* In c-common.c */
|
||||
extern tree truthvalue_conversion PROTO ((tree));
|
||||
extern int min_precision PROTO ((tree, int));
|
||||
@@ -2297,9 +2279,6 @@ extern tree case_index_expr_type PROTO ((void));
|
||||
extern HOST_WIDE_INT all_cases_count PROTO ((tree, int *));
|
||||
extern void check_for_full_enumeration_handling PROTO ((tree));
|
||||
extern void declare_nonlocal_label PROTO ((tree));
|
||||
#ifdef BUFSIZ
|
||||
extern void lang_print_xnode PROTO ((FILE *, tree, int));
|
||||
#endif
|
||||
|
||||
|
||||
/* If KIND=='I', return a suitable global initializer (constructor) name.
|
||||
|
||||
Reference in New Issue
Block a user