On 10/10/2016 14:59, Stephan Bosch wrote:
It should be supported by AIX:

https://www.ibm.com/support/knowledgecenter/SSGH3R_13.1.3/com.ibm.xlcpp1313.aix.doc/language_ref/compound_literals.html

OK - it is supported, but "not in the same way as gcc".


Getting it to simplified cases:

No GO is stated as: flexible array member cannot be used as a member of a structure - line25

   +23  struct yyy {
   +24          char *newLBL;
   +25          http_auth_param_t auth[];
   +26  };
   +27
   +28  struct yyy
   +29  YYY[] = {
   +30     (struct yyy) {
   +31        .newLBL = "LBL1"
   +32     },
   +33     (struct yyy) {
   +34        .newLBL = "LBL2"
   +35     }
   +36  };
!cc c99_comp_literal.c;
"c99_comp_literal.c", line 29.1: 1506-995 (S) An aggregate containing a flexible array member cannot be used as a member of a structure or as an array element.

So, to get it to work with a pointer "inside" the data needs to be initialized more like this:
(what was line 25, is now line 32)

   +11          struct xxx {
   +12                  char *lbl;
   +13                  http_auth_param_t a[];
   +14          };
   +15          struct xxx X1 = (struct xxx) {
   +16                  .lbl = "labelX",
   +17                  .a = {
   +18                     (http_auth_param_t) { .p1 = "c1" },
   +19                     (http_auth_param_t) { .p2 = "g2" },
   +20                     (http_auth_param_t) { }
   +21                  }
   +22          };
   +23          struct xxx X2 = (struct xxx) {
   +24                  .lbl = "labelX",
   +25                  .a = {
   +26                     (http_auth_param_t) { .p1 = "z1" },
   +27                     (http_auth_param_t) { }
   +28                  }
   +29          };
   +30  struct yyy {
   +31          char *newLBL;
   +32          http_auth_param_t *auth;
   +33  };
   +34
   +35  struct yyy
   +36  YYY[] = {
   +37     (struct yyy) {
   +38        .newLBL = "LBL1",
   +39        .auth = X1.a
   +40     },
   +41     (struct yyy) {
   +42        .newLBL = "LBL2",
   +43        .auth = X2.a
   +44     },
   +45     { }
   +46  };

Shall work on a 'patch' asap (which might be in 24+ hours)

Michael

Reply via email to