# HG changeset patch # User Carlo de Falco # Date 1359450890 -3600 # Node ID 5c824586de6694c5dd0ffb8d2979cf432df89a49 # 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: provide macros to invoke f77 functions verbosely. 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/libinterp/interpfcn/debug.h b/libinterp/interpfcn/debug.h --- a/libinterp/interpfcn/debug.h +++ b/libinterp/interpfcn/debug.h @@ -27,6 +27,7 @@ #include #include "ov.h" #include "dRowVector.h" +#include "f77-fcn.h" class octave_value_list; class octave_user_code; 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 @@ -74,6 +74,26 @@ } \ while (0) +/* Define verbose versions of the macros above */ +#if !defined (WARN_F77_FUNC_NAME) +#define F77_VERBOSE_FUNC(F, f, args) F77_FUNC (f, F) args +#define F77_VERBOSE_XFCN(F, f, args) F77_XFCN (f, F, args) +#else +#define F77_VERBOSE_FUNC(F, f, args) \ + (*current_liboctave_warning_with_id_handler) \ + ("Octave:f77-name", \ + "calling %s %s\ncalled from:\n\t%s at line %s", \ + STRINGIZE (F), STRINGIZE (args), \ + STRINGIZE(__FILE__), STRINGIZE(__LINE__)) +#define F77_VERBOSE_XFCN(F, f, args) \ + (*current_liboctave_warning_with_id_handler) \ + ("Octave:f77-name", \ + "calling %s %s\ncalled from:\n\t%s at line %s", \ + STRINGIZE (F), STRINGIZE (args), \ + STRINGIZE(__FILE__), STRINGIZE(__LINE__)); \ + F77_XFCN (f, F, args) +#endif + /* So we can check to see if an exception has occurred. */ CRUFT_API extern int f77_exception_encountered;