summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2019-11-27 11:25:43 -0500
committerGitHub <noreply@github.com>2019-11-27 11:25:43 -0500
commit6f84d25da4343f4426cd6a4cba91652fa512735a (patch)
treed29708cfa0b44a4cc793b73b33878f0196d15a61
parent6b88cae109f767a0796bd63604f06f01706f45cc (diff)
parent50db10a162f5929784f448152c1c0bca11dcd517 (diff)
Merge pull request #5435 from opensourcerouting/gcc4-vla-size
lib: add gcc 4.x workaround for frr_interface_info
-rw-r--r--lib/if.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index 9d0f13ecbd..f1565a089d 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1677,3 +1677,13 @@ const struct frr_yang_module_info frr_interface_info = {
},
}
};
+
+#if defined(__GNUC__) && ((__GNUC__ - 0) < 5) && !defined(__clang__)
+/* gcc versions before 5.x miscalculate the size for structs with variable
+ * length arrays (they just count it as size 0)
+ *
+ * NB: the "." below means "current position", i.e. this line must be
+ * immediately after the frr_interface_info variable!
+ */
+__asm__(".size\tfrr_interface_info, .-frr_interface_info\n");
+#endif