[Asterisk-code-review] app.h: Fix -Werror=zero-length-bounds compile errors in dev mode. (asterisk[16])

George Joseph asteriskteam at digium.com
Wed Mar 10 08:56:14 CST 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15610 )

Change subject: app.h: Fix -Werror=zero-length-bounds compile errors in dev mode.
......................................................................

app.h: Fix -Werror=zero-length-bounds compile errors in dev mode.

Change-Id: I5c104dc1f8417ccd3d01faf86e84ccbf89bc3b31
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M include/asterisk/app.h
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index 6323287..7690364 100644
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -1215,7 +1215,7 @@
   ast_app_separate_args() will perform that function before parsing
   the arguments.
  */
-#define AST_DECLARE_APP_ARGS(name, arglist) AST_DEFINE_APP_ARGS_TYPE(, arglist) name = { 0, }
+#define AST_DECLARE_APP_ARGS(name, arglist) AST_DEFINE_APP_ARGS_TYPE(argtype_##name, arglist) name = { 0, }
 
 /*!
   \brief Define a structure type to hold an application's arguments.
@@ -1233,10 +1233,13 @@
  */
 
 #define AST_DEFINE_APP_ARGS_TYPE(type, arglist) \
+	struct __subtype_##type { arglist }; \
 	struct type { \
 		unsigned int argc; \
-		char *argv[0]; \
-		arglist; \
+		union { \
+			char *argv[sizeof(struct __subtype_##type) / sizeof(char*)]; \
+			struct { arglist }; \
+		}; \
 	}
 
 /*!

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15610
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I5c104dc1f8417ccd3d01faf86e84ccbf89bc3b31
Gerrit-Change-Number: 15610
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210310/b8b3515d/attachment-0001.html>


More information about the asterisk-code-review mailing list