From 298d00e8d73c23b8b2537489aee4319a43968e9e Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sat, 23 Jul 2016 20:24:54 +0300 Subject: Include package name in include guard (issue #207). Fix suggested by Ulenspiegel. Also added testcase for the same. --- generator/nanopb_generator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'generator') 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: -- cgit 1.2.3-korg