Removing function names from errors (PR 9058)

Viktor Dukhovni openssl-users at dukhovni.org
Fri Jun 14 05:13:21 UTC 2019


On Fri, Jun 14, 2019 at 01:41:51PM +1000, Dr Paul Dale wrote:

> I’m behind ditching the function identifier #defines but not their text names.

Good to hear.

> #define ERR_raise_error ERR_raise_error_internal(__FILE__, __LINE__, __FUNC__)

Well, __FUNC__ is entirely non-standard, and __func__ is C99.  Are
we ready to abandon C89/C90?  If not, then __func__ (and variants)
becomes compiler-specific.

In test/testutil.h, we have some of the requisite gymnastics:

    # if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
    #  if defined(_MSC_VER)
    #   define TEST_CASE_NAME __FUNCTION__
    #  else
    #   define testutil_stringify_helper(s) #s
    #   define testutil_stringify(s) testutil_stringify_helper(s)
    #   define TEST_CASE_NAME __FILE__ ":" testutil_stringify(__LINE__)
    #  endif                        /* _MSC_VER */
    # else
    #  define TEST_CASE_NAME __func__
    # endif                         /* __STDC_VERSION__ */

While the GCC manual: http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Function-Names.html
suggests:

     #if __STDC_VERSION__ < 199901L
     # if __GNUC__ >= 2
     #  define __func__ __FUNCTION__
     # else
     #  define __func__ "<unknown>"
     # endif
     #endif

we would also need similar for any other pre-C99 supported compilers.

That said, I'm still in favour of function strings, and just the
error and library codes as numeric.

-- 
	Viktor.


More information about the openssl-project mailing list