Commit 21526606 by Eric Christopher

target-supports.exp (check-iconv-available): New function.

2004-02-26  Eric Christopher  <echristo@redhat.com>

	* lib/target-supports.exp (check-iconv-available): New function.
	* lib/gcc-dg.exp (dg-require-iconv): New function.
	Use above.
        * gcc.dg/charset: New directory.
        * gcc.dg/charset/charset.exp: New file.
        * gcc.dg/charset/asm1.c: Ditto.
        * gcc.dg/charset/asm2.c: Ditto.
        * gcc.dg/charset/asm3.c: Ditto.
        * gcc.dg/charset/asm4.c: Ditto.
        * gcc.dg/charset/asm5.c: Ditto.
        * gcc.dg/charset/attribute1.c: Ditto.
        * gcc.dg/charset/attribute2.c: Ditto.
        * gcc.dg/charset/string1.c: Ditto.
        * g++.dg/charset: New directory.
        * g++.dg/dg.exp: Add here. Special options.
        * g++.dg/charset/charset.exp: New file.
        * g++.dg/charset/asm1.c: Ditto.
        * g++.dg/charset/asm2.c: Ditto.
        * g++.dg/charset/asm3.c: Ditto.
        * g++.dg/charset/asm4.c: Ditto.
        * g++.dg/charset/attribute1.c: Ditto.
        * g++.dg/charset/attribute2.c: Ditto.
        * g++.dg/charset/extern1.cc: Ditto.
        * g++.dg/charset/extern2.cc: Ditto.
        * g++.dg/charset/string1.c: Ditto.

2004-02-26  Eric Christopher  <echristo@redhat.com>

	* c-lex.c (c_lex_string_translate): New variable.
	(lex_string): Use to determine string translation.
	* c-pragma.h: Prototype.
	* c-parse.in (start_string_translation): New. Set above.
	(stop_string_translation): Ditto.
	(attribute, attribute_list, asm_def, asm_stmt,
	asm_operand): Use above functions.
	* cp/parser.c (cp_parser_declaration): Translate strings
	unless token is RID_EXTERN. Set c_lex_string_translate
	for recursive use.
	(cp_parser_asm_definition): Only translate argument strings
	to asms.
	(cp_parser_asm_operand_list): Ditto.
	(cp_parser_attribute_list): Do not translate attribute strings.

From-SVN: r78548
parent 26d8bbbb
2004-02-26 Eric Christopher <echristo@redhat.com>
* c-lex.c (c_lex_string_translate): New variable.
(lex_string): Use to determine string translation.
* c-pragma.h: Prototype.
* c-parse.in (start_string_translation): New. Set above.
(stop_string_translation): Ditto.
(attribute, attribute_list, asm_def, asm_stmt,
asm_operand): Use above functions.
* cp/parser.c (cp_parser_declaration): Translate strings
unless token is RID_EXTERN. Set c_lex_string_translate
for recursive use.
(cp_parser_asm_definition): Only translate argument strings
to asms.
(cp_parser_asm_operand_list): Ditto.
(cp_parser_attribute_list): Do not translate attribute strings.
2004-02-26 Kazu Hirata <kazu@cs.umass.edu> 2004-02-26 Kazu Hirata <kazu@cs.umass.edu>
* stmt.c (expand_start_case_dummy): Remove. * stmt.c (expand_start_case_dummy): Remove.
...@@ -104,7 +121,7 @@ ...@@ -104,7 +121,7 @@
* cfglayout.c (break_superblocks): Likewise; fix memory leak. * cfglayout.c (break_superblocks): Likewise; fix memory leak.
* except.c (build_post_landing_pads, connect_post_landing_pads, * except.c (build_post_landing_pads, connect_post_landing_pads,
dw2_build_landing_pads, sjlj_emit_function_enter, dw2_build_landing_pads, sjlj_emit_function_enter,
sjlj_emit_function_exit, sjlj_emit_dispatch_table, sjlj_emit_function_exit, sjlj_emit_dispatch_table,
sjlj_build_landing_pads): Update CFG. sjlj_build_landing_pads): Update CFG.
(emit_to_new_bb_before): New function. (emit_to_new_bb_before): New function.
(finish_eh_generation): Do not rebuild the CFG. (finish_eh_generation): Do not rebuild the CFG.
...@@ -715,7 +732,7 @@ ...@@ -715,7 +732,7 @@
2004-02-23 Fariborz Jahanian <fjahanian@apple.com> 2004-02-23 Fariborz Jahanian <fjahanian@apple.com>
* config/rs6000/rs6000.c (function_arg): call to * config/rs6000/rs6000.c (function_arg): call to
rs6000_mixed_function_arg for DFmode moved to allow rs6000_mixed_function_arg for DFmode moved to allow
normal DFmode incoming register assignment. normal DFmode incoming register assignment.
2004-02-23 Dale Johannesen <dalej@apple.com> 2004-02-23 Dale Johannesen <dalej@apple.com>
...@@ -864,7 +881,7 @@ ...@@ -864,7 +881,7 @@
merely its number. merely its number.
(rs6000_attribute_table): Add "altivec" attribute. (rs6000_attribute_table): Add "altivec" attribute.
(rs6000_handle_altivec_attribute): New function. (rs6000_handle_altivec_attribute): New function.
* config/rs6000/rs6000.h (TARGET_OPTIONS): Describe * config/rs6000/rs6000.h (TARGET_OPTIONS): Describe
'-m[no-]-warn-altivec-long' (which '-W[no-]altivec-long-deprecated' '-m[no-]-warn-altivec-long' (which '-W[no-]altivec-long-deprecated'
maps to). maps to).
(rs6000_warn_altivec_long, rs6000_warn_altivec_long_switch): Forward (rs6000_warn_altivec_long, rs6000_warn_altivec_long_switch): Forward
......
...@@ -54,6 +54,7 @@ static splay_tree file_info_tree; ...@@ -54,6 +54,7 @@ static splay_tree file_info_tree;
int pending_lang_change; /* If we need to switch languages - C++ only */ int pending_lang_change; /* If we need to switch languages - C++ only */
int c_header_level; /* depth in C headers - C++ only */ int c_header_level; /* depth in C headers - C++ only */
bool c_lex_string_translate = true; /* If we need to translate characters received. */
static tree interpret_integer (const cpp_token *, unsigned int); static tree interpret_integer (const cpp_token *, unsigned int);
static tree interpret_float (const cpp_token *, unsigned int); static tree interpret_float (const cpp_token *, unsigned int);
...@@ -308,7 +309,7 @@ get_nonpadding_token (void) ...@@ -308,7 +309,7 @@ get_nonpadding_token (void)
timevar_pop (TV_CPP); timevar_pop (TV_CPP);
return tok; return tok;
} }
int int
c_lex_with_flags (tree *value, unsigned char *cpp_flags) c_lex_with_flags (tree *value, unsigned char *cpp_flags)
...@@ -675,7 +676,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string) ...@@ -675,7 +676,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (tok->type == CPP_WSTRING) if (tok->type == CPP_WSTRING)
wide = true; wide = true;
obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string)); obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string));
tok = get_nonpadding_token (); tok = get_nonpadding_token ();
if (c_dialect_objc () && tok->type == CPP_ATSIGN) if (c_dialect_objc () && tok->type == CPP_ATSIGN)
{ {
...@@ -693,7 +694,9 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string) ...@@ -693,7 +694,9 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (count > 1 && !objc_string && warn_traditional && !in_system_header) if (count > 1 && !objc_string && warn_traditional && !in_system_header)
warning ("traditional C rejects string constant concatenation"); warning ("traditional C rejects string constant concatenation");
if (cpp_interpret_string (parse_in, strs, count, &istr, wide)) if ((c_lex_string_translate
? cpp_interpret_string : cpp_interpret_string_notranslate)
(parse_in, strs, count, &istr, wide))
{ {
value = build_string (istr.len, (char *)istr.text); value = build_string (istr.len, (char *)istr.text);
free ((void *)istr.text); free ((void *)istr.text);
......
...@@ -1432,8 +1432,11 @@ attributes: ...@@ -1432,8 +1432,11 @@ attributes:
; ;
attribute: attribute:
ATTRIBUTE '(' '(' attribute_list ')' ')' ATTRIBUTE stop_string_translation
{ $$ = $4; } '(' '(' attribute_list ')' ')' start_string_translation
{ $$ = $5; }
| ATTRIBUTE error start_string_translation
{}
; ;
attribute_list: attribute_list:
...@@ -2480,8 +2483,9 @@ label: CASE expr_no_commas ':' ...@@ -2480,8 +2483,9 @@ label: CASE expr_no_commas ':'
/* simple_asm_expr is used in restricted contexts, where a full /* simple_asm_expr is used in restricted contexts, where a full
expression with inputs and outputs does not make sense. */ expression with inputs and outputs does not make sense. */
simple_asm_expr: simple_asm_expr:
ASM_KEYWORD '(' STRING ')' ASM_KEYWORD stop_string_translation
{ $$ = $3; } '(' STRING ')' start_string_translation
{ $$ = $4; }
; ;
/* maybeasm: used for assembly names for declarations */ /* maybeasm: used for assembly names for declarations */
...@@ -2495,14 +2499,17 @@ maybeasm: ...@@ -2495,14 +2499,17 @@ maybeasm:
asmdef: asmdef:
simple_asm_expr ';' simple_asm_expr ';'
{ assemble_asm ($1); } { assemble_asm ($1); }
| ASM_KEYWORD error start_string_translation ';'
{}
; ;
/* Full-blown asm statement with inputs, outputs, clobbers, and /* Full-blown asm statement with inputs, outputs, clobbers, and
volatile tag allowed. */ volatile tag allowed. */
asm_stmt: asm_stmt:
ASM_KEYWORD maybe_volatile '(' asm_argument ')' ';' ASM_KEYWORD maybe_volatile stop_string_translation
'(' asm_argument ')' start_string_translation ';'
{ stmt_count++; { stmt_count++;
$$ = build_asm_stmt ($2, $4); } $$ = build_asm_stmt ($2, $5); }
; ;
asm_argument: asm_argument:
...@@ -2550,12 +2557,13 @@ nonnull_asm_operands: ...@@ -2550,12 +2557,13 @@ nonnull_asm_operands:
; ;
asm_operand: asm_operand:
STRING '(' expr ')' STRING start_string_translation '(' expr ')' stop_string_translation
{ $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); } { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $4); }
| '[' identifier ']' STRING '(' expr ')' | '[' identifier ']' STRING start_string_translation
'(' expr ')' stop_string_translation
{ $2 = build_string (IDENTIFIER_LENGTH ($2), { $2 = build_string (IDENTIFIER_LENGTH ($2),
IDENTIFIER_POINTER ($2)); IDENTIFIER_POINTER ($2));
$$ = build_tree_list (build_tree_list ($2, $4), $6); } $$ = build_tree_list (build_tree_list ($2, $4), $7); }
; ;
asm_clobbers: asm_clobbers:
...@@ -2564,6 +2572,15 @@ asm_clobbers: ...@@ -2564,6 +2572,15 @@ asm_clobbers:
| asm_clobbers ',' STRING | asm_clobbers ',' STRING
{ $$ = tree_cons (NULL_TREE, $3, $1); } { $$ = tree_cons (NULL_TREE, $3, $1); }
; ;
stop_string_translation:
{ c_lex_string_translate = false; }
;
start_string_translation:
{ c_lex_string_translate = true; }
;
/* This is what appears inside the parens in a function declarator. /* This is what appears inside the parens in a function declarator.
Its value is a list of ..._TYPE nodes. Attributes must appear here Its value is a list of ..._TYPE nodes. Attributes must appear here
......
...@@ -57,4 +57,8 @@ extern void add_to_renaming_pragma_list (tree, tree); ...@@ -57,4 +57,8 @@ extern void add_to_renaming_pragma_list (tree, tree);
extern int c_lex (tree *); extern int c_lex (tree *);
extern int c_lex_with_flags (tree *, unsigned char *); extern int c_lex_with_flags (tree *, unsigned char *);
/* If true, then lex strings into the execution character set.
Otherwise, lex strings into the host character set. */
extern bool c_lex_string_translate;
#endif /* GCC_C_PRAGMA_H */ #endif /* GCC_C_PRAGMA_H */
This source diff could not be displayed because it is too large. You can view the blob instead.
2004-02-26 Eric Christopher <echristo@redhat.com>
* lib/target-supports.exp (check-iconv-available): New function.
* lib/gcc-dg.exp (dg-require-iconv): New function.
Use above.
* gcc.dg/charset: New directory.
* gcc.dg/charset/charset.exp: New file.
* gcc.dg/charset/asm1.c: Ditto.
* gcc.dg/charset/asm2.c: Ditto.
* gcc.dg/charset/asm3.c: Ditto.
* gcc.dg/charset/asm4.c: Ditto.
* gcc.dg/charset/asm5.c: Ditto.
* gcc.dg/charset/attribute1.c: Ditto.
* gcc.dg/charset/attribute2.c: Ditto.
* gcc.dg/charset/string1.c: Ditto.
* g++.dg/charset: New directory.
* g++.dg/dg.exp: Add here. Special options.
* g++.dg/charset/charset.exp: New file.
* g++.dg/charset/asm1.c: Ditto.
* g++.dg/charset/asm2.c: Ditto.
* g++.dg/charset/asm3.c: Ditto.
* g++.dg/charset/asm4.c: Ditto.
* g++.dg/charset/attribute1.c: Ditto.
* g++.dg/charset/attribute2.c: Ditto.
* g++.dg/charset/extern1.cc: Ditto.
* g++.dg/charset/extern2.cc: Ditto.
* g++.dg/charset/string1.c: Ditto.
2004-02-26 Mark Mitchell <mark@codesourcery.com> 2004-02-26 Mark Mitchell <mark@codesourcery.com>
PR c++/14278 PR c++/14278
...@@ -89,7 +117,7 @@ ...@@ -89,7 +117,7 @@
* gcc.dg/altivec-6.c: New test case. * gcc.dg/altivec-6.c: New test case.
* gcc.dg/altivec-[7-9].c: Generalize target triple; add * gcc.dg/altivec-[7-9].c: Generalize target triple; add
type casts as needed. type casts as needed.
* gcc.dg/altivec-10.c: Include altivec_check.h and call * gcc.dg/altivec-10.c: Include altivec_check.h and call
altivec_check(). altivec_check().
* gcc.dg/altivec-12.c: New test case. * gcc.dg/altivec-12.c: New test case.
* gcc.dg/altivec-varargs-1.c: Generalize target triple; * gcc.dg/altivec-varargs-1.c: Generalize target triple;
...@@ -21063,5 +21091,3 @@ rlsruhe.de> ...@@ -21063,5 +21091,3 @@ rlsruhe.de>
correspond to c-torture 1.11. correspond to c-torture 1.11.
* New file. * New file.
/* { dg-do compile { target *-*-* } }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler ".ascii bar" } }
{ dg-final { scan-assembler ".ascii foo" } }
*/
extern int x, y;
asm (".ascii bar");
int foo (void)
{
__asm__ (".ascii foo");
return 0;
}
/* Test for complex asm statements. Make sure it compiles
then test for some of the asm statements not being translated. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "std" } }
{ dg-final { scan-assembler "cld" } }
{ dg-final { scan-assembler "rep" } }
{ dg-final { scan-assembler "movsb" } } */
#define size_t int
void *
memmove (void *__dest, __const void *__src, size_t __n)
{
register unsigned long int __d0, __d1, __d2;
if (__dest < __src)
__asm__ __volatile__
("cld\n\t"
"rep\n\t"
"movsb"
: "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
: "0" (__n), "1" (__src), "2" (__dest)
: "memory");
else
__asm__ __volatile__
("std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
: "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
: "0" (__n), "1" (__n - 1 + (const char *) __src),
"2" (__n - 1 + (char *) __dest)
: "memory");
return __dest;
}
/* Simple asm test. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "foo" } } */
extern int bar;
int main (void)
{
asm ("foo %0" : "=r" (bar));
}
/* Test for string translation. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler-not "translate" } } */
void foo (void)
{
asm ("xx" : : "r"("translate") : "cc");
}
/* Test for attribute non-translation. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "foo" } } */
int walrus __attribute__ ((section (".foo")));
int main (void)
{
return 0;
}
/* Test to make sure that invalid attributes aren't translated.
If error recovery is ever testable then "foobar" should be
translated. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
*/
int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */
char x[] = "foobar";
# Copyright (C) 2004 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.
# GCC testsuite that uses the 'dg.exp' driver.
# There's a bunch of headers we need.
if [is_remote host] {
foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] {
remote_download host $header
}
}
# Load support procs.
load_lib g++-dg.exp
load_lib target-supports.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS "-fexec-charset=IBM-1047"
}
# Initialize `dg'.
dg-init
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \
"" $DEFAULT_CFLAGS
# All done.
dg-finish
/* Test extern statments not being translated. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
*/
extern "C" {
int testbug (void) {
return 0;
}
} //extern block
/* Check that we push the declaration and then continue translation. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler-not "foobar" } } */
extern "C" { char *foo = "foobar"; }
/* Simple character translation test. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler-not "string foobar" } } */
char *foo = "string foobar";
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# G++ testsuite that uses the `dg.exp' driver. # G++ testsuite that uses the `dg.exp' driver.
...@@ -32,6 +32,7 @@ dg-init ...@@ -32,6 +32,7 @@ dg-init
# that are handled specially. # that are handled specially.
set tests [lsort [find $srcdir/$subdir *.C]] set tests [lsort [find $srcdir/$subdir *.C]]
set tests [prune $tests $srcdir/$subdir/bprob/*] set tests [prune $tests $srcdir/$subdir/bprob/*]
set tests [prune $tests $srcdir/$subdir/charset/*]
set tests [prune $tests $srcdir/$subdir/compat/*] set tests [prune $tests $srcdir/$subdir/compat/*]
set tests [prune $tests $srcdir/$subdir/debug/*] set tests [prune $tests $srcdir/$subdir/debug/*]
set tests [prune $tests $srcdir/$subdir/gcov/*] set tests [prune $tests $srcdir/$subdir/gcov/*]
......
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler ".ascii bar" } }
{ dg-final { scan-assembler ".ascii foo" } }
*/
extern int x, y;
asm (".ascii bar");
int foo (void)
{
__asm__ (".ascii foo");
return 0;
}
/* Test for execution character set encoding errors.
If we ever get a good way to test error recovery
the string "foobar" should be translated. */
/* { dg-do compile } */
/* { dg-require-iconv "IBM-1047" } */
asm (not_a_string); /* { dg-error "syntax error before" "not_a_string" } */
char x[] = "foobar";
void foo (void)
{
char *y;
asm (not_a_string2); /* { dg-error "syntax error before" "not_a_string" } */
#define FOO "walrus"
y = FOO;
}
/* Test for complex asm statements. Make sure it compiles
then test for some of the asm statements not being translated. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "std" } }
{ dg-final { scan-assembler "cld" } }
{ dg-final { scan-assembler "rep" } }
{ dg-final { scan-assembler "movsb" } } */
#define size_t int
void *
memmove (void *__dest, __const void *__src, size_t __n)
{
register unsigned long int __d0, __d1, __d2;
if (__dest < __src)
__asm__ __volatile__
("cld\n\t"
"rep\n\t"
"movsb"
: "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
: "0" (__n), "1" (__src), "2" (__dest)
: "memory");
else
__asm__ __volatile__
("std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
: "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
: "0" (__n), "1" (__n - 1 + (const char *) __src),
"2" (__n - 1 + (char *) __dest)
: "memory");
return __dest;
}
/* Simple asm test. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "foo" } } */
extern int bar;
int main (void)
{
asm ("foo %0" : "=r" (bar));
}
/* Test for string translation. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler-not "translate" } } */
void foo (void)
{
asm ("xx" : : "r"("translate") : "cc");
}
/* Test for attribute non-translation. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler "foo" } } */
int walrus __attribute__ ((section (".foo")));
int main (void)
{
return 0;
}
/* Test to make sure that invalid attributes aren't translated.
If error recovery is ever testable then "foobar" should be
translated. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
*/
int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */
char x[] = "foobar";
# Copyright (C) 2004 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.
# GCC testsuite that uses the 'dg.exp' driver.
# There's a bunch of headers we need.
if [is_remote host] {
foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] {
remote_download host $header
}
}
# Load support procs.
load_lib gcc-dg.exp
load_lib target-supports.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_CHARSETCFLAGS
if ![info exists DEFAULT_CHARSETCFLAGS] then {
set DEFAULT_CHARSETCFLAGS "-fexec-charset=IBM-1047"
}
# Initialize `dg'.
dg-init
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \
"" $DEFAULT_CHARSETCFLAGS
# All done.
dg-finish
/* Simple character translation test. */
/* { dg-do compile }
{ dg-require-iconv "IBM-1047" }
{ dg-final { scan-assembler-not "string foobar" } } */
char *foo = "string foobar";
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
load_lib dg.exp load_lib dg.exp
load_lib file-format.exp load_lib file-format.exp
...@@ -175,7 +175,7 @@ proc gcc-dg-runtest { testcases default-extra-flags } { ...@@ -175,7 +175,7 @@ proc gcc-dg-runtest { testcases default-extra-flags } {
global runtests global runtests
foreach test $testcases { foreach test $testcases {
# If we're only testing specific files and this isn't one of # If we're only testing specific files and this isn't one of
# them, skip it. # them, skip it.
if ![runtest_file_p $runtests $test] { if ![runtest_file_p $runtests $test] {
continue continue
...@@ -226,7 +226,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { ...@@ -226,7 +226,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
global runtests global runtests
foreach test $testcases { foreach test $testcases {
# If we're only testing specific files and this isn't one of # If we're only testing specific files and this isn't one of
# them, skip it. # them, skip it.
if ![runtest_file_p $runtests $test] { if ![runtest_file_p $runtests $test] {
continue continue
...@@ -237,7 +237,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { ...@@ -237,7 +237,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
foreach flags $DEBUG_TORTURE_OPTIONS { foreach flags $DEBUG_TORTURE_OPTIONS {
set doit 1 set doit 1
if { [string match {*/debug-[126].c} "$nshort"] \ if { [string match {*/debug-[126].c} "$nshort"] \
&& [string match "*1" [lindex "$flags" 0] ] } { && [string match "*1" [lindex "$flags" 0] ] } {
set doit 0 set doit 0
} }
...@@ -333,7 +333,7 @@ proc dg-require-profiling { args } { ...@@ -333,7 +333,7 @@ proc dg-require-profiling { args } {
# If this target does not support DLL attributes skip this test. # If this target does not support DLL attributes skip this test.
proc dg-require-dll { args } { proc dg-require-dll { args } {
global target_triplet global target_triplet
# As a special case, the mcore-*-elf supports dllimport/dllexport. # As a special case, the mcore-*-elf supports dllimport/dllexport.
if { [string match "mcore-*-elf" $target_triplet] } { if { [string match "mcore-*-elf" $target_triplet] } {
...@@ -348,6 +348,15 @@ proc dg-require-dll { args } { ...@@ -348,6 +348,15 @@ proc dg-require-dll { args } {
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
} }
proc dg-require-iconv { args } {
if { ![ check_iconv_available ${args} ] } {
upvar dg-do-what dg-do-what
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
return
}
return
}
# Prune any messages matching ARGS[1] (a regexp) from test output. # Prune any messages matching ARGS[1] (a regexp) from test output.
proc dg-prune-output { args } { proc dg-prune-output { args } {
global additional_prunes global additional_prunes
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to: # Please email any bugs, comments, and/or additions to this file to:
# gcc-patches@gcc.gnu.org # gcc-patches@gcc.gnu.org
...@@ -31,13 +31,13 @@ proc check_weak_available { } { ...@@ -31,13 +31,13 @@ proc check_weak_available { } {
global target_cpu global target_cpu
# All mips targets should support it # All mips targets should support it
if { [ string first "mips" $target_cpu ] >= 0 } { if { [ string first "mips" $target_cpu ] >= 0 } {
return 1 return 1
} }
# All solaris2 targets should support it # All solaris2 targets should support it
if { [regexp ".*-solaris2.*" $target_triplet] } { if { [regexp ".*-solaris2.*" $target_triplet] } {
return 1 return 1
} }
...@@ -139,7 +139,7 @@ proc check_alias_available { } { ...@@ -139,7 +139,7 @@ proc check_alias_available { } {
} }
} }
} }
verbose "check_alias_available returning $alias_available_saved" 2 verbose "check_alias_available returning $alias_available_saved" 2
} }
...@@ -187,7 +187,7 @@ proc check_profiling_available { test_what } { ...@@ -187,7 +187,7 @@ proc check_profiling_available { test_what } {
# exist on any irix6 system currently posting testsuite results. # exist on any irix6 system currently posting testsuite results.
# Support for -pg on irix relies on gcrt1.o which doesn't exist yet. # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
# See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
if { [istarget mips*-*-irix*] if { [istarget mips*-*-irix*]
&& ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } { && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
return 0 return 0
} }
...@@ -201,13 +201,44 @@ proc check_profiling_available { test_what } { ...@@ -201,13 +201,44 @@ proc check_profiling_available { test_what } {
|| [istarget strongarm*-*-elf] || [istarget strongarm*-*-elf]
|| [istarget xscale*-*-elf] || [istarget xscale*-*-elf]
|| [istarget cris-*-*] || [istarget cris-*-*]
|| [istarget h8300-*-*] || [istarget h8300-*-*]
|| [istarget *-*-windiss] } { || [istarget *-*-windiss] } {
set profiling_available_saved 0 set profiling_available_saved 0
} else { } else {
set profiling_available_saved 1 set profiling_available_saved 1
} }
} }
return $profiling_available_saved return $profiling_available_saved
} }
# Return true if iconv is supported on the target. In particular IBM-1047.
proc check_iconv_available { test_what } {
global tool
set result ""
verbose "check_iconv_available compiling testfile" 1
set f [open "tmp.c" "w"]
# Compile a small test program.
puts $f "#include <iconv.h>\n"
puts $f "int main (void)\n {\n iconv_t cd; \n"
puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
puts $f "return 0;\n}"
close $f
set lines [${tool}_target_compile "tmp.c" "tmp.x" executable ""]
set result [${tool}_load "./tmp.x" "" ""]
set status [lindex $result 0];
verbose "status is <$status>"
if { $status == "pass" } then {
return 1
}
return 0
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment