Menu

#2 Get rid of: ISO C does not support ‘__FUNCTION__’ predefined identifier [-Wpedantic]

1.0
closed
nobody
None
2020-02-24
2017-01-19
Michael Nix
No

The way I compile the simulator I get the warning: ISO C does not support ‘__FUNCTION__’ predefined identifier [-Wpedantic].

From The GCC manual: "Note that these semantics are deprecated, and that GCC 3.2 will handle __FUNCTION__ and __PRETTY_FUNCTION__ the same way as __func__. __func__ is defined by the ISO standard C99: [...]"

Proposed change:

*** GpMacros.h  2017-01-19 22:01:58.032958059 +0100
--- GpMacros.h  2017-01-19 22:03:28.126847433 +0100
***************
*** 90,96 ****
  #if defined _POSIX_
  #   define FUNCTION_NAME        0
  #else
! #   define FUNCTION_NAME        __FUNCTION__
  #endif
  #ifdef NO_FAIL_TRACE
  #   define FAIL(errorCode) (TpmFail(errorCode))       /* kgold was TmpFAIL */
--- 90,96 ----
  #if defined _POSIX_
  #   define FUNCTION_NAME        0
  #else
! #   define FUNCTION_NAME        __func__
  #endif
  #ifdef NO_FAIL_TRACE
  #   define FAIL(errorCode) (TpmFail(errorCode))       /* kgold was TmpFAIL */

I tested it by compiling and it gets rid of the warnings. Couldn't provoke an error yet, so I didn't test its runtime behaviour.

Discussion

  • Ken Goldman

    Ken Goldman - 2017-01-27

    It's on my list to find a portable, cross platform, multi-compiler solution and feed it back to the maintainer of this file.

    However, in general, the consensus is that we looking for bugs that cause the TPM to malfunction. Warnings caused by the pedantic flag that do not cause any error are low down on the list. Submit them with those expectations.

     
  • Michael Nix

    Michael Nix - 2017-01-27

    I submitted them with no expectations. Just trying to give back.

    There are a few more warnings, but I figured, after submitting the 3 tickets, that you will get rid of them when you have the time. They're all minor and self explanatory.

     
  • Ken Goldman

    Ken Goldman - 2020-02-24
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB