cocotb: Compile error in VhpiCbHdl.cpp: expected ‘)’ before ‘PRIu32’

I’m getting the following error:

  In file included from cocotb/share/include/gpi.h:60,
                   from cocotb/share/lib/vhpi/../gpi/gpi_priv.h:32,
                   from cocotb/share/lib/vhpi/VhpiImpl.h:31,
                   from cocotb/share/lib/vhpi/VhpiCbHdl.cpp:29:
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp: In member function ‘virtual GpiIterator::Status VhpiIterator::next_handle(std::string&, GpiObjHdl**, void**)’:
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp:1150:69: error: expected ‘)’ before ‘PRIu32’
   1150 |         LOG_DEBUG("Unable to get the name for this object of type " PRIu32, type);
        |                                                                     ^~~~~~
  cocotb/share/include/gpi_logging.h:52:98: note: in definition of macro ‘LOG_DEBUG’
     52 | #define LOG_DEBUG(...)     gpi_log("cocotb.gpi", GPIDebug,         __FILE__, __func__, __LINE__, __VA_ARGS__);
        |                                                                                                  ^~~~~~~~~~~
  cocotb/share/include/gpi_logging.h:52:35: note: to match this ‘(’
     52 | #define LOG_DEBUG(...)     gpi_log("cocotb.gpi", GPIDebug,         __FILE__, __func__, __LINE__, __VA_ARGS__);
        |                                   ^
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp:1150:9: note: in expansion of macro ‘LOG_DEBUG’
   1150 |         LOG_DEBUG("Unable to get the name for this object of type " PRIu32, type);
        |         ^~~~~~~~~
  error: command 'gcc' failed with exit status 1

This came in via #1361 (https://github.com/cocotb/cocotb/pull/1361/files#diff-8baf84ef545a81134ec388a5b271c5b6R1131).

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 21 (18 by maintainers)

Commits related to this issue

Most upvoted comments

If I include<cinttypes> before "inttypes.h" in https://github.com/cocotb/cocotb/blob/master/cocotb/share/include/vpi_user.h#L40, then it works.

My inttypes.h has the definition of PRIu32 et al. wrapped as follows:

/* The ISO C99 standard specifies that these macros must only be
   defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS