[RFC,09/18] gdb.base/{exprs,ptype,ptype1,setvar,whatis}.c C++ify

Message ID 20200914001437.31157-10-pedro@palves.net
State New
Headers show
Series
  • Allow building (more) C tests with a C++ compiler
Related show

Commit Message

Pedro Alves Sept. 14, 2020, 12:14 a.m.
This adjusts:

 gdb.base/{exprs,ptype,ptype1,setvar,whatis}.c,

to make them buildable as C++ programs.
---
 gdb/testsuite/gdb.base/exprs.c  | 4 ++--
 gdb/testsuite/gdb.base/ptype.c  | 8 ++++----
 gdb/testsuite/gdb.base/ptype1.c | 2 +-
 gdb/testsuite/gdb.base/setvar.c | 4 ++--
 gdb/testsuite/gdb.base/whatis.c | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.14.5

Patch

diff --git a/gdb/testsuite/gdb.base/exprs.c b/gdb/testsuite/gdb.base/exprs.c
index cd605f39d30..195b88e9142 100644
--- a/gdb/testsuite/gdb.base/exprs.c
+++ b/gdb/testsuite/gdb.base/exprs.c
@@ -156,7 +156,7 @@  double		v_double_func () { return (0.0); }
 struct link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
@@ -166,7 +166,7 @@  struct link {
 union tu_link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c
index 4148da771e1..6d12c2add42 100644
--- a/gdb/testsuite/gdb.base/ptype.c
+++ b/gdb/testsuite/gdb.base/ptype.c
@@ -168,7 +168,7 @@  double		v_double_func () { return (0.0); }
 struct link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
@@ -178,7 +178,7 @@  struct link {
 union tu_link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
@@ -269,11 +269,11 @@  func_type v_func_type;
 
 /***********/
 
-extern char charfoo ();
+extern char charfoo (int);
 
 typedef int foo;
 
-foo intfoo (afoo)
+foo intfoo (int afoo)
 {
   charfoo (afoo);
   return (afoo * 2);
diff --git a/gdb/testsuite/gdb.base/ptype1.c b/gdb/testsuite/gdb.base/ptype1.c
index 25871509cba..43ab05694e2 100644
--- a/gdb/testsuite/gdb.base/ptype1.c
+++ b/gdb/testsuite/gdb.base/ptype1.c
@@ -1,6 +1,6 @@ 
 typedef char foo;
 
-foo charfoo (afoo)
+foo charfoo (int afoo)
 {
   return (afoo * 2);
 }
diff --git a/gdb/testsuite/gdb.base/setvar.c b/gdb/testsuite/gdb.base/setvar.c
index 1b8d8088654..415eb6f2aaa 100644
--- a/gdb/testsuite/gdb.base/setvar.c
+++ b/gdb/testsuite/gdb.base/setvar.c
@@ -161,7 +161,7 @@  double		v_double_func () { return (0.0); }
 struct link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
@@ -171,7 +171,7 @@  struct link {
 union tu_link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
diff --git a/gdb/testsuite/gdb.base/whatis.c b/gdb/testsuite/gdb.base/whatis.c
index 11c84d291cd..743cb61abfe 100644
--- a/gdb/testsuite/gdb.base/whatis.c
+++ b/gdb/testsuite/gdb.base/whatis.c
@@ -207,7 +207,7 @@  double		v_double_func () { return (0.0); }
 struct link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif
@@ -217,7 +217,7 @@  struct link {
 union tu_link {
 	struct link *next;
 #ifdef __STDC__
-	struct link *(*linkfunc) (struct link *this, int flags);
+	struct link *(*linkfunc) (struct link *self, int flags);
 #else
 	struct link *(*linkfunc) ();
 #endif