Skip to content

Commit

Permalink
Prevent swig4.0.1 segfault (#1924)
Browse files Browse the repository at this point in the history
swig 4.0.1 is the default on Ubuntu 20.04 LTS which is still in use.

Workaround for swig/swig#1643

Co-authored-by: dilpath <[email protected]>
  • Loading branch information
dweindl and dilpath authored Jan 11, 2023
1 parent 8f6c380 commit c7b613f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions include/amici/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ class Logger
std::string const& message
);

#if SWIG_VERSION >= 0x040002
/**
* @brief Add a log entry with printf-like message formatting
* @param severity Severity level
* @param identifier Short identifier for the logged event
* @param format printf format string
* @param ... arguments to be formatted
*/
void log(
LogSeverity severity,
std::string const& identifier,
const char* format, ...
);
#else
// swig 4.0.1 segfaults on "@param ..."
// see https://github.com/swig/swig/issues/1643
/**
* @brief Add a log entry with printf-like message formatting
* @param severity Severity level
* @param identifier Short identifier for the logged event
* @param format printf format string
*/
#endif
void
log(LogSeverity severity, std::string const& identifier, char const* format,
...);

/** The log items */
std::vector<LogItem> items;
Expand Down

0 comments on commit c7b613f

Please sign in to comment.