spicy
spicy copied to clipboard
Change `--output-prototypes` to imply `--disable-optimizations`
Because optimization ends up removing the supposed unused prototypes we want to see.
Update TODO in doc/extending.rst once done.
One tricky aspect of this is that this could lead to users generating C++ files with optimizations while emitted prototypes would always be without optimizations. This could then expose different interfaces which might lead to linker failures; when I did the naive change I got
$ btest -dv spicy/types/unit/synchronize-on-gap.test
spicy.types.unit.synchronize-on-gap ...
> spicyc -cdo sync.cc sync.spicy -D optimizer >>output 2>&1
> spicyc -ldo sync-linker.cc sync.spicy -D optimizer >>output 2>&1
> spicyc -Pdo sync.h sync.spicy -D optimizer >>output 2>&1
> $(spicy-config --cxx-launcher --cxx) -o main main.cc sync.cc sync-linker.cc $(spicy-config --debug --cxxflags --ldflags)
... spicy.types.unit.synchronize-on-gap failed
% '$(spicy-config --cxx-launcher --cxx) -o main main.cc sync.cc sync-linker.cc $(spicy-config --debug --cxxflags --ldflags)' failed unexpectedly (exit code 1)
% cat .stderr
Undefined symbols for architecture x86_64:
"__hlt::sync::Xs::__str__()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > hilti::rt::detail::adl::to_string<__hlt::sync::Xs, (void*)0>(__hlt::sync::Xs const&, hilti::rt::detail::adl::tag) in main-d0bc7a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
1 of 1 test failed