aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Shan <shanyu@google.com>2018-07-26 20:00:48 -0400
committerYu Shan <shanyu@google.com>2018-08-16 16:05:21 -0700
commitc9c123244c4432673f5757241263e9dde8380fe0 (patch)
treea59f0b9620389ebb642366debccffc2cd0455d79
parent86bd676e064ac4336400328f34bf187a7794464e (diff)
downloadnanopb-c-c9c123244c4432673f5757241263e9dde8380fe0.tar.gz
Add legacy macro definition for precompiled files.
There are existing precompiled .pb.c and .pb.h files in our tree. They were compiled using nanopb 0.2.8 and 0.3.9 changes some of the macro definition. In order to be compatible with those files, we add back the legacy macro definition. Added patch is at pb.h.patch. Test: None Bug: 111798740 Change-Id: I83454ae49a77331a6d8b2471cd1e8ae80397cffd (cherry picked from commit c31a0b32ffe7748c64527e9b030d0358ad114bf7)
-rw-r--r--patches/pb.h.patch27
-rw-r--r--pb.h6
2 files changed, 33 insertions, 0 deletions
diff --git a/patches/pb.h.patch b/patches/pb.h.patch
new file mode 100644
index 0000000..f269b7d
--- /dev/null
+++ b/patches/pb.h.patch
@@ -0,0 +1,27 @@
+diff --git a/pb.h b/pb.h
+index 174a84b..52d24de 100644
+--- a/pb.h
++++ b/pb.h
+@@ -122,6 +122,11 @@
+ #define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
+ #define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER
+ #endif
++#ifndef STATIC_ASSERT
++#define STATIC_ASSERT PB_STATIC_ASSERT
++#define STATIC_ASSERT_MSG PB_STATIC_ASSERT_MSG
++#define STATIC_ASSERT_MSG_ PB_STATIC_ASSERT_MSG_
++#endif
+ #else
+ #define PB_STATIC_ASSERT(COND,MSG)
+ #endif
+@@ -526,6 +531,7 @@ struct pb_extension_s {
+ PB_ ## rules ## _ ## allocation(tag, message, field, \
+ PB_DATAOFFSET_ ## placement(message, field, prevfield), \
+ PB_LTYPE_MAP_ ## type, ptr)
++#define PB_FIELD2 PB_FIELD
+
+ /* Field description for repeated static fixed count fields.*/
+ #define PB_REPEATED_FIXED_COUNT(tag, type, placement, message, field, prevfield, ptr) \
+--
+2.18.0.345.g5c9ce644c3-goog
+
diff --git a/pb.h b/pb.h
index 174a84b..52d24de 100644
--- a/pb.h
+++ b/pb.h
@@ -122,6 +122,11 @@
#define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
#define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER
#endif
+#ifndef STATIC_ASSERT
+#define STATIC_ASSERT PB_STATIC_ASSERT
+#define STATIC_ASSERT_MSG PB_STATIC_ASSERT_MSG
+#define STATIC_ASSERT_MSG_ PB_STATIC_ASSERT_MSG_
+#endif
#else
#define PB_STATIC_ASSERT(COND,MSG)
#endif
@@ -526,6 +531,7 @@ struct pb_extension_s {
PB_ ## rules ## _ ## allocation(tag, message, field, \
PB_DATAOFFSET_ ## placement(message, field, prevfield), \
PB_LTYPE_MAP_ ## type, ptr)
+#define PB_FIELD2 PB_FIELD
/* Field description for repeated static fixed count fields.*/
#define PB_REPEATED_FIXED_COUNT(tag, type, placement, message, field, prevfield, ptr) \