diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-08 20:23:23 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-08 20:23:27 +0800 |
commit | 7bf9526f5edacd91602b9b9b07247e7a7b46fcc2 (patch) | |
tree | 30868976e176c848bcfcea0ded63bd26d5b47049 /libsolc | |
parent | 5b4ad10b3c2bca1deee0d45bced3bde9e7438b5f (diff) | |
download | dexon-solidity-7bf9526f5edacd91602b9b9b07247e7a7b46fcc2.tar.gz dexon-solidity-7bf9526f5edacd91602b9b9b07247e7a7b46fcc2.tar.zst dexon-solidity-7bf9526f5edacd91602b9b9b07247e7a7b46fcc2.zip |
Mark libsolc external C functions as noexcept
These are part of the external C API where leaking through exceptions makes no sense.
Diffstat (limited to 'libsolc')
-rw-r--r-- | libsolc/libsolc.cpp | 18 | ||||
-rw-r--r-- | libsolc/libsolc.h | 24 |
2 files changed, 24 insertions, 18 deletions
diff --git a/libsolc/libsolc.cpp b/libsolc/libsolc.cpp index 26ce98ce..6931ed08 100644 --- a/libsolc/libsolc.cpp +++ b/libsolc/libsolc.cpp @@ -270,46 +270,46 @@ static string s_outputBuffer; extern "C" { -extern char const* license() +extern char const* license() noexcept { static string fullLicenseText = otherLicenses + licenseText; return fullLicenseText.c_str(); } -extern char const* version() +extern char const* version() noexcept { return VersionString.c_str(); } -extern char const* compileJSON(char const* _input, bool _optimize) +extern char const* compileJSON(char const* _input, bool _optimize) noexcept { s_outputBuffer = compileSingle(_input, _optimize); return s_outputBuffer.c_str(); } -extern char const* compileJSONMulti(char const* _input, bool _optimize) +extern char const* compileJSONMulti(char const* _input, bool _optimize) noexcept { s_outputBuffer = compileMulti(_input, _optimize); return s_outputBuffer.c_str(); } -extern char const* compileJSONCallback(char const* _input, bool _optimize, CStyleReadFileCallback _readCallback) +extern char const* compileJSONCallback(char const* _input, bool _optimize, CStyleReadFileCallback _readCallback) noexcept { s_outputBuffer = compileMulti(_input, _optimize, _readCallback); return s_outputBuffer.c_str(); } -extern char const* compileStandard(char const* _input, CStyleReadFileCallback _readCallback) +extern char const* compileStandard(char const* _input, CStyleReadFileCallback _readCallback) noexcept { s_outputBuffer = compileStandardInternal(_input, _readCallback); return s_outputBuffer.c_str(); } -extern char const* solidity_license() +extern char const* solidity_license() noexcept { /// todo: make this the default or an alias return license(); } -extern char const* solidity_version() +extern char const* solidity_version() noexcept { /// todo: make this the default or an alias return version(); } -extern char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback) +extern char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback) noexcept { /// todo: make this the default or an alias return compileStandard(_input, _readCallback); diff --git a/libsolc/libsolc.h b/libsolc/libsolc.h index 2cc004d4..e959b758 100644 --- a/libsolc/libsolc.h +++ b/libsolc/libsolc.h @@ -23,6 +23,12 @@ #include <stdbool.h> #ifdef __cplusplus +#define SOLC_NOEXCEPT noexcept +#else +#define SOLC_NOEXCEPT +#endif + +#ifdef __cplusplus extern "C" { #endif @@ -30,16 +36,16 @@ extern "C" { /// heap-allocated and are free'd by the caller. typedef void (*CStyleReadFileCallback)(char const* _path, char** o_contents, char** o_error); -char const* license(); -char const* version(); -char const* compileJSON(char const* _input, bool _optimize); -char const* compileJSONMulti(char const* _input, bool _optimize); -char const* compileJSONCallback(char const* _input, bool _optimize, CStyleReadFileCallback _readCallback); -char const* compileStandard(char const* _input, CStyleReadFileCallback _readCallback); +char const* license() SOLC_NOEXCEPT; +char const* version() SOLC_NOEXCEPT; +char const* compileJSON(char const* _input, bool _optimize) SOLC_NOEXCEPT; +char const* compileJSONMulti(char const* _input, bool _optimize) SOLC_NOEXCEPT; +char const* compileJSONCallback(char const* _input, bool _optimize, CStyleReadFileCallback _readCallback) SOLC_NOEXCEPT; +char const* compileStandard(char const* _input, CStyleReadFileCallback _readCallback) SOLC_NOEXCEPT; -char const* solidity_license(); -char const* solidity_version(); -char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback); +char const* solidity_license() SOLC_NOEXCEPT; +char const* solidity_version() SOLC_NOEXCEPT; +char const* solidity_compile(char const* _input, CStyleReadFileCallback _readCallback) SOLC_NOEXCEPT; #ifdef __cplusplus } |