aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/charset
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/charset')
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm1.c14
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm2.c16
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm3.c33
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm4.c10
-rw-r--r--gcc/testsuite/gcc.dg/charset/asm5.c8
-rw-r--r--gcc/testsuite/gcc.dg/charset/attribute1.c10
-rw-r--r--gcc/testsuite/gcc.dg/charset/attribute2.c8
-rw-r--r--gcc/testsuite/gcc.dg/charset/charset.exp44
-rw-r--r--gcc/testsuite/gcc.dg/charset/string.c5
9 files changed, 148 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/charset/asm1.c b/gcc/testsuite/gcc.dg/charset/asm1.c
new file mode 100644
index 0000000..d7578d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/asm1.c
@@ -0,0 +1,14 @@
+/* { 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;
+}
diff --git a/gcc/testsuite/gcc.dg/charset/asm2.c b/gcc/testsuite/gcc.dg/charset/asm2.c
new file mode 100644
index 0000000..4af7a18
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/asm2.c
@@ -0,0 +1,16 @@
+/* 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;
+}
diff --git a/gcc/testsuite/gcc.dg/charset/asm3.c b/gcc/testsuite/gcc.dg/charset/asm3.c
new file mode 100644
index 0000000..7cc1379
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/asm3.c
@@ -0,0 +1,33 @@
+/* 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;
+}
diff --git a/gcc/testsuite/gcc.dg/charset/asm4.c b/gcc/testsuite/gcc.dg/charset/asm4.c
new file mode 100644
index 0000000..cd850c3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/asm4.c
@@ -0,0 +1,10 @@
+/* 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));
+}
diff --git a/gcc/testsuite/gcc.dg/charset/asm5.c b/gcc/testsuite/gcc.dg/charset/asm5.c
new file mode 100644
index 0000000..fa93f40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/asm5.c
@@ -0,0 +1,8 @@
+/* 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");
+}
diff --git a/gcc/testsuite/gcc.dg/charset/attribute1.c b/gcc/testsuite/gcc.dg/charset/attribute1.c
new file mode 100644
index 0000000..993c793
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/attribute1.c
@@ -0,0 +1,10 @@
+/* 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;
+}
diff --git a/gcc/testsuite/gcc.dg/charset/attribute2.c b/gcc/testsuite/gcc.dg/charset/attribute2.c
new file mode 100644
index 0000000..4ce95a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/attribute2.c
@@ -0,0 +1,8 @@
+/* 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";
diff --git a/gcc/testsuite/gcc.dg/charset/charset.exp b/gcc/testsuite/gcc.dg/charset/charset.exp
new file mode 100644
index 0000000..ad75cb5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/charset.exp
@@ -0,0 +1,44 @@
+# 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
diff --git a/gcc/testsuite/gcc.dg/charset/string.c b/gcc/testsuite/gcc.dg/charset/string.c
new file mode 100644
index 0000000..375e28a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/string.c
@@ -0,0 +1,5 @@
+/* Simple character translation test. */
+/* { dg-do compile }
+ { dg-require-iconv "IBM-1047" }
+ { dg-final { scan-assembler-not "string foobar" } } */
+char *foo = "string foobar";