Make sure gcc gives error for passing scoped_dohptr to Printv()
After making this mistake too many times already, make sure it doesn't happen again by requiring gcc to give an error for any attempt to pass a non-trivial object to vararg functions such as Printv(), Printf(), Swig_error() etc.
This commit is contained in:
parent
7cbbfab198
commit
606c1c6ea0
1 changed files with 7 additions and 0 deletions
|
|
@ -29,6 +29,13 @@ int SwigType_isbuiltin(SwigType *t) {
|
|||
namespace
|
||||
{
|
||||
|
||||
// When using scoped_dohptr, it's very simple to accidentally pass it to a vararg function, such as Printv() or Printf(), resulting in catastrophic results
|
||||
// during run-time (crash or, worse, junk in the generated output), so make sure gcc warning about this, which is not enabled by default for some reason (see
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64867 for more information), is enabled.
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic error "-Wconditionally-supported"
|
||||
#endif // __GNUC__
|
||||
|
||||
// Delete a DOH object on scope exit.
|
||||
class scoped_dohptr
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue