changeset 21037:b4d6e7cd28db

maint: Avoid GCC_ATTR_RETURN in typedef which clang can't compile. * lo-error.h: Remove GCC_ATTR_NORETURN from typedef for liboctave_error_handler and liboctave_error_with_id_handler. * lo-error.h (current_liboctave_error_handler, current_liboctave_error_with_id_handler): Add GCC_ATTR_RETURN to the declaration of global variables. * lo-error.h (set_liboctave_error_handler, set_liboctave_error_with_id_handler): Add GCC_ATTR_NO_RETURN to argument passed in to function. * lo-error.c (current_liboctave_error_handler, current_liboctave_error_with_id_handler, set_liboctave_error_handler, set_liboctave_error_with_id_handler): Add GCC_ATTR_NO_RETURN to variables and functions whose prototypes were changed in lo-error.h. * octave.cc (lo_error_handler, lo_error_with_id_handler): Add GCC_ATTR_NORETURN to functions to match prototype of set_liboctave_error_XXX_handler.
author Rik <rik@octave.org>
date Tue, 05 Jan 2016 08:57:08 -0800
parents b432e7bb3cbd
children 53bded18aba6
files libinterp/octave.cc liboctave/cruft/misc/lo-error.c liboctave/cruft/misc/lo-error.h
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave.cc	Tue Jan 05 13:44:53 2016 +0100
+++ b/libinterp/octave.cc	Tue Jan 05 08:57:08 2016 -0800
@@ -456,7 +456,7 @@
   safe_source_file (fname, context, verbose, require_file, "octave");
 }
 
-static void
+GCC_ATTR_NORETURN static void
 lo_error_handler (const char *fmt, ...)
 {
   va_list args;
@@ -467,7 +467,7 @@
   octave_throw_execution_exception ();
 }
 
-static void
+GCC_ATTR_NORETURN static void
 lo_error_with_id_handler (const char *id, const char *fmt, ...)
 {
   va_list args;
--- a/liboctave/cruft/misc/lo-error.c	Tue Jan 05 13:44:53 2016 +0100
+++ b/liboctave/cruft/misc/lo-error.c	Tue Jan 05 08:57:08 2016 -0800
@@ -34,11 +34,11 @@
    symbol errors when creating shared versions of libcruft. */
 
 /* Pointer to the current error handling function. */
-liboctave_error_handler current_liboctave_error_handler
+GCC_ATTR_NORETURN liboctave_error_handler current_liboctave_error_handler
   = liboctave_fatal;
 
 /* Pointer to the current error_with_id handling function. */
-liboctave_error_with_id_handler current_liboctave_error_with_id_handler
+GCC_ATTR_NORETURN liboctave_error_with_id_handler current_liboctave_error_with_id_handler
   = liboctave_fatal_with_id;
 
 /* Pointer to the current warning handler. */
@@ -61,7 +61,7 @@
 }
 
 void
-set_liboctave_error_handler (liboctave_error_handler f)
+set_liboctave_error_handler (GCC_ATTR_NORETURN liboctave_error_handler f)
 {
   if (f)
     current_liboctave_error_handler = f;
@@ -70,7 +70,7 @@
 }
 
 void
-set_liboctave_error_with_id_handler (liboctave_error_with_id_handler f)
+set_liboctave_error_with_id_handler (GCC_ATTR_NORETURN liboctave_error_with_id_handler f)
 {
   if (f)
     current_liboctave_error_with_id_handler = f;
--- a/liboctave/cruft/misc/lo-error.h	Tue Jan 05 13:44:53 2016 +0100
+++ b/liboctave/cruft/misc/lo-error.h	Tue Jan 05 08:57:08 2016 -0800
@@ -36,9 +36,9 @@
 
 extern void liboctave_warning_with_id (const char *id, const char *fmt, ...);
 
-typedef GCC_ATTR_NORETURN void (*liboctave_error_handler) (const char *, ...);
+typedef void (*liboctave_error_handler) (const char *, ...);
 
-typedef GCC_ATTR_NORETURN void (*liboctave_error_with_id_handler) (const char *, const char *, ...);
+typedef void (*liboctave_error_with_id_handler) (const char *, const char *, ...);
 
 typedef void (*liboctave_warning_handler) (const char *, ...);
 
@@ -46,17 +46,17 @@
 
 /* Would be nice to make these pointers private, but we want to share
    them among all the liboctave classes. */
-CRUFT_API extern liboctave_error_handler current_liboctave_error_handler;
+GCC_ATTR_NORETURN CRUFT_API extern liboctave_error_handler current_liboctave_error_handler;
 
-CRUFT_API extern liboctave_error_with_id_handler current_liboctave_error_with_id_handler;
+GCC_ATTR_NORETURN CRUFT_API extern liboctave_error_with_id_handler current_liboctave_error_with_id_handler;
 
 CRUFT_API extern liboctave_warning_handler current_liboctave_warning_handler;
 
 CRUFT_API extern liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler;
 
-CRUFT_API extern void set_liboctave_error_handler (liboctave_error_handler f);
+CRUFT_API extern void set_liboctave_error_handler (GCC_ATTR_NORETURN liboctave_error_handler f);
 
-CRUFT_API extern void set_liboctave_error_with_id_handler (liboctave_error_with_id_handler f);
+CRUFT_API extern void set_liboctave_error_with_id_handler (GCC_ATTR_NORETURN liboctave_error_with_id_handler f);
 
 CRUFT_API extern void set_liboctave_warning_handler (liboctave_warning_handler f);