Skip to content
Snippets Groups Projects
Commit b03be4fa authored by Petteri Aimonen's avatar Petteri Aimonen
Browse files

Add syntax specification to .proto files (issue #167)

Eliminates a warning on protoc 3.0.
parent 6e72df48
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 6 deletions
// A very simple protocol definition, consisting of only
// one message.
syntax = "proto2";
message SimpleMessage {
required int32 lucky_number = 1;
}
......
......@@ -2,6 +2,8 @@
//
// See also the nanopb-specific options in fileproto.options.
syntax = "proto2";
message ListFilesRequest {
optional string path = 1 [default = "/"];
}
......
// A very simple protocol definition, consisting of only
// one message.
syntax = "proto2";
message SimpleMessage {
required int32 lucky_number = 1;
}
......
// A message containing doubles, as used by other applications.
syntax = "proto2";
message DoubleMessage {
required double field1 = 1;
required double field2 = 2;
......
......@@ -5,6 +5,8 @@
// but they are commonly implemented by filling out exactly one of
// several optional fields.
syntax = "proto2";
message MsgType1
{
required int32 value = 1;
......
syntax = "proto2";
// package name placeholder
message SubMessage {
required string substuff1 = 1 [default = "1"];
required int32 substuff2 = 2 [default = 2];
......
syntax = "proto2";
message SubMessage {
required string substuff1 = 1 [default = "1"];
required int32 substuff2 = 2 [default = 2];
......
syntax = "proto2";
message SubMessage {
optional string stringvalue = 1;
repeated int32 int32value = 2;
......
syntax = "proto2";
import "nanopb.proto";
message Person {
......
syntax = "proto2";
import 'nanopb.proto';
message IntegerArray {
......
......@@ -2,6 +2,8 @@
// These can only be handled in pointer/callback mode,
// see associated .options files.
syntax = "proto2";
message TreeNode
{
optional int32 leaf = 1;
......
......@@ -4,6 +4,8 @@
* a bit of a problem for the encoder/decoder (issue #164).
*/
syntax = "proto2";
import 'nanopb.proto';
option (nanopb_fileopt).long_names = false;
......
syntax = "proto2";
import 'alltypes.proto';
extend AllTypes {
......
syntax = "proto2";
message SubMessage {
required string substuff1 = 1 [default = "1"];
required int32 substuff2 = 2 [default = 2];
......
syntax = "proto2";
message SubMessage {
required string substuff1 = 1 [default = "1"];
required int32 substuff2 = 2 [default = 2];
......
......@@ -2,16 +2,19 @@
Import("env", "malloc_env")
def set_pkgname(src, dst, pkgname):
data = open(str(src)).read()
placeholder = '// package name placeholder'
assert placeholder in data
data = data.replace(placeholder, 'package %s;' % pkgname)
open(str(dst), 'w').write(data)
# We want both pointer and static versions of the AllTypes message
# Prefix them with package name.
env.Command("alltypes_static.proto", "#alltypes/alltypes.proto",
lambda target, source, env:
open(str(target[0]), 'w').write("package alltypes_static;\n"
+ open(str(source[0])).read()))
lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_static'))
env.Command("alltypes_pointer.proto", "#alltypes/alltypes.proto",
lambda target, source, env:
open(str(target[0]), 'w').write("package alltypes_pointer;\n"
+ open(str(source[0])).read()))
lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_pointer'))
p1 = env.NanopbProto(["alltypes_pointer", "alltypes_pointer.options"])
p2 = env.NanopbProto(["alltypes_static", "alltypes_static.options"])
......
......@@ -6,6 +6,8 @@
* otherwise. E.g. uint32 + IS_8 => uint8_t
*/
syntax = "proto2";
import 'nanopb.proto';
message IntSizes {
......
syntax = "proto2";
enum MessageStatus {
FAIL = 0;
OK = 1;
......
syntax = "proto2";
import 'nanopb.proto';
import 'messages1.proto';
......
/* Test for one missing field among many */
syntax = "proto2";
message AllFields
{
required int32 field1 = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment