Skip to content

Commit c7b613f

Browse files
dweindldilpath
andauthored
Prevent swig4.0.1 segfault (#1924)
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]>
1 parent 8f6c380 commit c7b613f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

include/amici/logging.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,27 @@ class Logger
3636
std::string const& message
3737
);
3838

39+
#if SWIG_VERSION >= 0x040002
3940
/**
4041
* @brief Add a log entry with printf-like message formatting
4142
* @param severity Severity level
4243
* @param identifier Short identifier for the logged event
4344
* @param format printf format string
4445
* @param ... arguments to be formatted
4546
*/
46-
void log(
47-
LogSeverity severity,
48-
std::string const& identifier,
49-
const char* format, ...
50-
);
47+
#else
48+
// swig 4.0.1 segfaults on "@param ..."
49+
// see https://github.com/swig/swig/issues/1643
50+
/**
51+
* @brief Add a log entry with printf-like message formatting
52+
* @param severity Severity level
53+
* @param identifier Short identifier for the logged event
54+
* @param format printf format string
55+
*/
56+
#endif
57+
void
58+
log(LogSeverity severity, std::string const& identifier, char const* format,
59+
...);
5160

5261
/** The log items */
5362
std::vector<LogItem> items;

0 commit comments

Comments
 (0)