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