summaryrefslogtreecommitdiffstats
path: root/generator/nanopb_generator.py
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2016-07-23 20:24:54 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2016-07-23 20:24:54 +0300
commit298d00e8d73c23b8b2537489aee4319a43968e9e (patch)
tree77a3f92d36d7dcb4f7ee3b4642074ddaa4cefcdb /generator/nanopb_generator.py
parent9c36b59603c8a52edb8d786d1d6ef4f429f56ece (diff)
Include package name in include guard (issue #207).
Fix suggested by Ulenspiegel. Also added testcase for the same.
Diffstat (limited to 'generator/nanopb_generator.py')
-rwxr-xr-xgenerator/nanopb_generator.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 64514577..9cf2de5f 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -1045,7 +1045,10 @@ class ProtoFile:
else:
yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime())
- symbol = make_identifier(headername)
+ if self.fdesc.package:
+ symbol = make_identifier(self.fdesc.package + '_' + headername)
+ else:
+ symbol = make_identifier(headername)
yield '#ifndef PB_%s_INCLUDED\n' % symbol
yield '#define PB_%s_INCLUDED\n' % symbol
try: