1 # Test anonymous_oneof generator option
8 if 'PROTOC_VERSION' in env:
9 match = re.search('([0-9]+).([0-9]+).([0-9]+)', env['PROTOC_VERSION'])
12 version = map(int, match.groups())
14 # Oneof is supported by protoc >= 2.6.0
15 if env.GetOption('clean') or (match and (version[0] > 2 or (version[0] == 2 and version[1] >= 6))):
16 # Anonymous oneofs are supported by clang and gcc
17 if 'clang' in env['CC'] or 'gcc' in env['CC']:
19 env2.Append(CFLAGS = "-Wno-pedantic")
20 env2.NanopbProto('oneof')
22 dec = env2.Program(['decode_oneof.c',
24 '$COMMON/pb_decode.o',
25 '$COMMON/pb_common.o'])
27 env2.RunTest("message1.txt", [dec, '$BUILD/oneof/message1.pb'], ARGS = ['1'])
28 env2.RunTest("message2.txt", [dec, '$BUILD/oneof/message2.pb'], ARGS = ['2'])
29 env2.RunTest("message3.txt", [dec, '$BUILD/oneof/message3.pb'], ARGS = ['3'])