kazuho/picojson

picojson does not support -fno-exceptions

Opened this issue · 3 comments

rhysd commented

Repro

  1. Put file as foo.cc with below content
  2. Run clang++ -fno-exceptions foo.cc
#include "/path/to/picojson.h"
int main() { return 0; }
// foo.cc

Expected

It compiles successfully

Actual

Many compilation errors for example:

picojson.h:1142:3: error: cannot use 'throw' with exceptions disabled
  PICOJSON_ASSERT(0);
  ^

As long as PICO JSON uses std:: it will not be usable in "no exceptions" projects.

Since PICO JSON is "pico" it will be not a big job (I assume) to make it usable with alternatives to std:: containers. One example is EASTL.

The first step might be a slight redesign so that PICO JSON itself does not throw exceptions.

rhysd commented

at least libc++ supports -fno-exceptions

https://reviews.llvm.org/D20677

Go ahead: fork and pull :)