# HG changeset patch # User Carlo de Falco # Date 1359408421 -3600 # Node ID 3ee11fe728a5122ffca45d2ef600e6115e183c08 # Parent f75ffcc82acbbd7e0c769b7f674b793da98eb8ff Add an option to warn each time a f77 subroutine is invoked. configure.ac: add a configure test for the option --enable-f77-warn name. f77-fcn.h: conditionally add a warning to the macro for invoking f77 subroutines. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -175,6 +175,19 @@ AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"], [Define this to be the path to the shell command interpreter.]) +### Print a warning message every time a F77 function is invoked and print the function name. +### Disabled by default. + +WARN_F77_FUNC_NAME=false +AC_ARG_ENABLE([warn-f77-name], + [AS_HELP_STRING([--enable-warn-f77-name], + [every time a fortran77 function is invoked, issue a warning with the function name. You probably do NOT want to enable this feature.])], + [if test "$enableval" = yes; then WARN_F77_FUNC_NAME=true; fi], []) +if $WARN_F77_FUNC_NAME; then + AC_DEFINE(WARN_F77_FUNC_NAME, 1, + [Define to 1 to use octave_allocator class.]) +fi + ### Enable bounds checking on element references within Octave's array and ### matrix classes. This slows down some operations a bit, so it is turned off ### by default. diff --git a/liboctave/cruft/misc/f77-fcn.h b/liboctave/cruft/misc/f77-fcn.h --- a/liboctave/cruft/misc/f77-fcn.h +++ b/liboctave/cruft/misc/f77-fcn.h @@ -48,6 +48,16 @@ to the top level. The error_state should be checked immediately after this macro is used. */ +#if !defined (WARN_F77_FUNC_NAME) + #define F77_WARN_NAME(f, F) +#else + #define F77_WARN_NAME(f, F) \ + (*current_liboctave_warning_with_id_handler) \ + ("Octave:f77-name", \ + "invoking Fortran subroutine %s", \ + STRINGIZE (F)) +#endif + #define F77_XFCN(f, F, args) \ do \ { \ @@ -67,6 +77,7 @@ else \ { \ octave_interrupt_immediately++; \ + F77_WARN_NAME(f, F); \ F77_FUNC (f, F) args; \ octave_interrupt_immediately--; \ octave_restore_current_context (saved_context); \