[Asterisk-code-review] app.h: Restore C++ compatibility for macro AST_DECLARE_APP_ARGS (asterisk[18])

George Joseph asteriskteam at digium.com
Tue Feb 23 13:39:38 CST 2021


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

Change subject: app.h: Restore C++ compatibility for macro AST_DECLARE_APP_ARGS
......................................................................

app.h: Restore C++ compatibility for macro AST_DECLARE_APP_ARGS

This partially reverts commit 3d1bf3c537bba0416f691f48165fdd0a32554e8a,
specifically for app.h.

This works with both gcc 9.3.0 and 10.2.0 now, both for C and C++ (as
tested with external modules).

ASTERISK-29287

Change-Id: I5b9f02a9b290675682a1d13f1788fdda597c9fca
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M include/asterisk/app.h
1 file changed, 2 insertions(+), 4 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 91d06aa..6323287 100644
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -1235,10 +1235,8 @@
 #define AST_DEFINE_APP_ARGS_TYPE(type, arglist) \
 	struct type { \
 		unsigned int argc; \
-		union { \
-			char *argv[sizeof(struct {arglist}) / sizeof(char *)]; \
-			struct {arglist}; \
-		}; \
+		char *argv[0]; \
+		arglist; \
 	}
 
 /*!

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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I5b9f02a9b290675682a1d13f1788fdda597c9fca
Gerrit-Change-Number: 15504
Gerrit-PatchSet: 2
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
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/20210223/1df54d24/attachment.html>


More information about the asterisk-code-review mailing list