* gdb.base/langs.exp, gdb.base/langs*: New test.
authorJim Kingdon <jkingdon@engr.sgi.com>
Sun, 12 Feb 1995 17:55:09 +0000 (17:55 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Sun, 12 Feb 1995 17:55:09 +0000 (17:55 +0000)
* gdb.base/Makefile.in: Build it.
* TODO: Remove item about checking that C names don't get C++
demangling applied; this test tests it.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/.Sanitize
gdb/testsuite/gdb.base/langs0.c [new file with mode: 0644]
gdb/testsuite/gdb.base/langs1.c [new file with mode: 0644]
gdb/testsuite/gdb.base/langs1.f [new file with mode: 0644]
gdb/testsuite/gdb.base/langs2.c [new file with mode: 0644]
gdb/testsuite/gdb.base/langs2.cxx [new file with mode: 0644]

index a068761..3814532 100644 (file)
@@ -1,3 +1,10 @@
+Sun Feb 12 08:11:58 1995  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+       * gdb.base/langs.exp, gdb.base/langs*: New test.
+       * gdb.base/Makefile.in: Build it.
+       * TODO: Remove item about checking that C names don't get C++
+       demangling applied; this test tests it.
+
 Thu Feb  9 12:43:56 1995  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * gdb.stabs/weird.exp: Remove "Haven't examined" comment which
index 364d600..b42f6e8 100644 (file)
@@ -50,6 +50,12 @@ i486-elf.u
 i860-elf.u
 interrupt.c
 interrupt.exp
+langs.exp
+langs0.c
+langs1.c
+langs1.f
+langs2.c
+langs2.cxx
 list.exp
 list0.c
 list0.h
diff --git a/gdb/testsuite/gdb.base/langs0.c b/gdb/testsuite/gdb.base/langs0.c
new file mode 100644 (file)
index 0000000..2790e2d
--- /dev/null
@@ -0,0 +1,24 @@
+/* This file is actually in C, it is not supposed to simulate something
+   translated from another language or anything like that.  */
+int
+csub (x)
+     int x;
+{
+  return x + 1;
+}
+
+int
+langs0__2do ()
+{
+  return fsub_ () + 2;
+}
+
+int
+main ()
+{
+  if (langs0__2do () == 5003)
+    /* Success.  */
+    return 0;
+  else
+    return 1;
+}
diff --git a/gdb/testsuite/gdb.base/langs1.c b/gdb/testsuite/gdb.base/langs1.c
new file mode 100644 (file)
index 0000000..7842259
--- /dev/null
@@ -0,0 +1,33 @@
+/* langs1.f -- translated by f2c (version of 5 May 1990  1:12:08).  */
+
+/* f2c output hacked as follows for GDB testsuite:
+   1.  Change commented out "#" lines to #line directives.
+       I don't know why this behavior isn't the default for f2c -g.
+   2.  Remove include of f2c.h and put in just a typedef for "integer".
+   Additional notes:
+   3.  f2c was called as "f2c -g langs1.f".
+   4.  We don't need to use the fortran libraries.  */
+
+typedef int integer;
+
+/* Table of constant values */
+
+static integer c__10000 = 10000;
+
+/* I am not sure whether there is a way to have a fortran program without */
+/* a MAIN, but it does not really harm us to have one. */
+/* Main program */ MAIN__()
+{
+} /* MAIN__ */
+
+#line 4 "langs1.f"
+/* Subroutine */ int fsub_()
+{
+    extern integer cppsub_();
+
+#line 5 "langs1.f"
+#line 6 "langs1.f"
+    return cppsub_(&c__10000);
+#line 7 "langs1.f"
+} /* fsub_ */
+
diff --git a/gdb/testsuite/gdb.base/langs1.f b/gdb/testsuite/gdb.base/langs1.f
new file mode 100644 (file)
index 0000000..35ce691
--- /dev/null
@@ -0,0 +1,7 @@
+c I am not sure whether there is a way to have a fortran program without
+c a MAIN, but it does not really harm us to have one.
+      end
+      subroutine fsub
+        integer*4 cppsub
+        return (cppsub (10000))
+      end
diff --git a/gdb/testsuite/gdb.base/langs2.c b/gdb/testsuite/gdb.base/langs2.c
new file mode 100644 (file)
index 0000000..69f290d
--- /dev/null
@@ -0,0 +1,15 @@
+/* This is intended to be a vague simulation of cfront output.  */
+#line 1 "langs2.cxx"
+extern int csub ();
+int
+foo__Fi (x) int x;
+{
+  return csub (x / 2);
+}
+
+extern int cppsub_ (int *);
+int
+cppsub_ (y) int *y;
+{
+  return foo__Fi (*y);
+}
diff --git a/gdb/testsuite/gdb.base/langs2.cxx b/gdb/testsuite/gdb.base/langs2.cxx
new file mode 100644 (file)
index 0000000..d8ee56c
--- /dev/null
@@ -0,0 +1,13 @@
+extern "C" int csub (int);
+int
+foo (int x)
+{
+  return csub (x / 2);
+}
+
+extern "C" int cppsub_ (int);
+int
+cppsub_ (int *y)
+{
+  return foo (*y);
+}