SConscript 752 B

1234567891011121314151617
  1. # Regression test for #494:
  2. # Using sizeof on anonymous union not allowed in C++, in message_size oneof sizing fallback
  3. Import('env')
  4. import os, sys
  5. # The build rules here are a bit tricky to make the normal dependency
  6. # resolution intentionally fail. This causes the generator to use the fallback
  7. # define which had the problem with C++.
  8. env.Command("oneof.pb", "oneof.proto", "$PROTOC $PROTOCFLAGS -I$BUILDDIR/regression/issue_494 -o$TARGETS $SOURCES")
  9. env.Command(["oneof.pb.c", "oneof.pb.h"], "oneof.pb", env['NANOPB_GENERATOR'] + " -D$BUILDDIR/regression/issue_494 $SOURCES")
  10. env.NanopbProto("submessage.proto")
  11. env.Depends("oneof.pb", "submessage.proto")
  12. test = env.Program(["oneof_size.cc"])
  13. env.Depends(test, "oneof.pb.h")
  14. env.RunTest(test)