diff options
author | Pedro Alves <palves@redhat.com> | 2016-10-06 19:23:37 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-10-06 19:23:37 +0100 |
commit | ddb6d633875b76f9d772af901118233fc498253a (patch) | |
tree | ccd8e35d3579538c607829b41c050586104848ca | |
parent | 33fa2c6e1b1e63599156f7d79de8c0a6ea69c8af (diff) | |
download | gdb-ddb6d633875b76f9d772af901118233fc498253a.zip gdb-ddb6d633875b76f9d772af901118233fc498253a.tar.gz gdb-ddb6d633875b76f9d772af901118233fc498253a.tar.bz2 |
gdb: Remove some C compiler support leftovers
Remove some __cplusplus checks, inline EXPORTED_CONST, and update some comments.
gdb/ChangeLog:
2016-10-06 Pedro Alves <palves@redhat.com>
* cp-valprint.c (vtbl_ptr_name): Write "extern const" instead of
EXPORTED_CONST.
* stub-termcap.c: Remove __cplusplus checks.
* common/common-defs.h [!__cplusplus] (EXTERN_C, EXTERN_C_PUSH,
EXTERN_C_POP): Delete.
* common/common-exceptions.h (GDB_XCPT_SJMP): Update comments.
(GDB_XCPT) [!__cplusplus]: Delete.
(throw_exception, throw_exception_sjlj): Update comments.
* guile/guile-internal.h (as_a_scm_t_subr) [!__cplusplus]: Delete.
* guile/guile.c (extension_language_guile): Write "extern const"
instead of EXPORTED_CONST.
* features/feature_to_c.sh: Don't emit !__cplusplus code. Write
"extern const" instead of EXPORTED_CONST.
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/common/common-defs.h | 12 | ||||
-rw-r--r-- | gdb/common/common-exceptions.h | 23 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 2 | ||||
-rwxr-xr-x | gdb/features/feature_to_c.sh | 7 | ||||
-rw-r--r-- | gdb/guile/guile-internal.h | 8 | ||||
-rw-r--r-- | gdb/guile/guile.c | 2 | ||||
-rw-r--r-- | gdb/stub-termcap.c | 4 |
8 files changed, 30 insertions, 44 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 502d3de..e1cfc19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2016-10-06 Pedro Alves <palves@redhat.com> + + * cp-valprint.c (vtbl_ptr_name): Write "extern const" instead of + EXPORTED_CONST. + * stub-termcap.c: Remove __cplusplus checks. + * common/common-defs.h [!__cplusplus] (EXTERN_C, EXTERN_C_PUSH, + EXTERN_C_POP): Delete. + * common/common-exceptions.h (GDB_XCPT_SJMP): Update comments. + (GDB_XCPT) [!__cplusplus]: Delete. + (throw_exception, throw_exception_sjlj): Update comments. + * guile/guile-internal.h (as_a_scm_t_subr) [!__cplusplus]: Delete. + * guile/guile.c (extension_language_guile): Write "extern const" + instead of EXPORTED_CONST. + * features/feature_to_c.sh: Don't emit !__cplusplus code. Write + "extern const" instead of EXPORTED_CONST. + 2016-10-06 Doug Evans <dje@google.com> * python/py-value.c (valpy_long): Handle unsigned values. diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h index 2c94117..0d8d100 100644 --- a/gdb/common/common-defs.h +++ b/gdb/common/common-defs.h @@ -75,14 +75,8 @@ #include "cleanups.h" #include "common-exceptions.h" -#ifdef __cplusplus -# define EXTERN_C extern "C" -# define EXTERN_C_PUSH extern "C" { -# define EXTERN_C_POP } -#else -# define EXTERN_C extern -# define EXTERN_C_PUSH -# define EXTERN_C_POP -#endif +#define EXTERN_C extern "C" +#define EXTERN_C_PUSH extern "C" { +#define EXTERN_C_POP } #endif /* COMMON_DEFS_H */ diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h index 6bf7e40..4cc56b4 100644 --- a/gdb/common/common-exceptions.h +++ b/gdb/common/common-exceptions.h @@ -119,8 +119,7 @@ struct gdb_exception /* The different exception mechanisms that TRY/CATCH can map to. */ -/* Make GDB exceptions use setjmp/longjmp behind the scenes. This is - the only mode supported when GDB is built as a C program. */ +/* Make GDB exceptions use setjmp/longjmp behind the scenes. */ #define GDB_XCPT_SJMP 1 /* Make GDB exceptions use try/catch behind the scenes. */ @@ -132,11 +131,7 @@ struct gdb_exception spurious code between the TRY and the CATCH block. */ #define GDB_XCPT_RAW_TRY 3 -#ifdef __cplusplus -# define GDB_XCPT GDB_XCPT_TRY -#else -# define GDB_XCPT GDB_XCPT_SJMP -#endif +#define GDB_XCPT GDB_XCPT_TRY /* Functions to drive the sjlj-based exceptions state machine. Though declared here by necessity, these functions should be considered @@ -305,18 +300,16 @@ struct gdb_quit_bad_alloc /* *INDENT-ON* */ -/* Throw an exception (as described by "struct gdb_exception"). When - GDB is built as a C program, executes a LONG JUMP to the inner most - containing exception handler established using TRY/CATCH. When - built as a C++ program, throws a C++ exception, using "throw". */ +/* Throw an exception (as described by "struct gdb_exception"), + landing in the inner most containing exception handler established + using TRY/CATCH. */ extern void throw_exception (struct gdb_exception exception) ATTRIBUTE_NORETURN; /* Throw an exception by executing a LONG JUMP to the inner most - containing exception handler established using TRY_SJLJ. Works the - same regardless of whether GDB is built as a C program or a C++ - program. Necessary in some cases where we need to throw GDB - exceptions across third-party library code (e.g., readline). */ + containing exception handler established using TRY_SJLJ. Necessary + in some cases where we need to throw GDB exceptions across + third-party library code (e.g., readline). */ extern void throw_exception_sjlj (struct gdb_exception exception) ATTRIBUTE_NORETURN; diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 7b0c19a..5fb2561 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -88,7 +88,7 @@ static void cp_print_value (struct type *, struct type *, /* GCC versions after 2.4.5 use this. */ -EXPORTED_CONST char vtbl_ptr_name[] = "__vtbl_ptr_type"; +extern const char vtbl_ptr_name[] = "__vtbl_ptr_type"; /* Return truth value for assertion that TYPE is of the type "pointer to virtual function". */ diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh index 439611a..37de0b3 100755 --- a/gdb/features/feature_to_c.sh +++ b/gdb/features/feature_to_c.sh @@ -64,12 +64,7 @@ done echo >> $output -echo "#ifdef __cplusplus" >> $output -echo "# define EXPORTED_CONST extern const" >> $output -echo "#else" >> $output -echo "# define EXPORTED_CONST const" >> $output -echo "#endif" >> $output -echo "EXPORTED_CONST char *const xml_builtin[][2] = {" >> $output +echo "extern const char *const xml_builtin[][2] = {" >> $output for input; do basename=`echo $input | sed 's,.*/,,'` diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h index 0aa4a0a..5f819b8 100644 --- a/gdb/guile/guile-internal.h +++ b/gdb/guile/guile-internal.h @@ -50,8 +50,6 @@ typedef struct #define END_VARIABLES { NULL, SCM_BOOL_F, NULL } -#ifdef __cplusplus - /* Although scm_t_subr is meant to hold a function pointer, at least in some versions of guile, it is actually a typedef to "void *". That means that in C++, an explicit cast is necessary to convert @@ -88,12 +86,6 @@ as_a_scm_t_subr (SCM (*func) (SCM, SCM, SCM)) return (scm_t_subr) func; } -#else - -/* In C, just do an implicit conversion. */ -#define as_a_scm_t_subr(func) func - -#endif /* Scheme functions to define during initialization. */ typedef struct diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 117561d..3a19eec 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -77,7 +77,7 @@ extern const struct extension_language_ops guile_extension_ops; /* The main struct describing GDB's interface to the Guile extension language. */ -EXPORTED_CONST struct extension_language_defn extension_language_guile = +extern const struct extension_language_defn extension_language_guile = { EXT_LANG_GUILE, "guile", diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c index f382823..ed3e605 100644 --- a/gdb/stub-termcap.c +++ b/gdb/stub-termcap.c @@ -22,9 +22,7 @@ #include "defs.h" -#ifdef __cplusplus extern "C" { -#endif /* -Wmissing-prototypes */ extern int tgetent (char *buffer, char *termtype); @@ -34,9 +32,7 @@ extern char* tgetstr (char *name, char **area); extern int tputs (char *string, int nlines, int (*outfun) (int)); extern char *tgoto (const char *cap, int col, int row); -#ifdef __cplusplus } -#endif /* These globals below are global termcap variables that readline references. |