[MacPorts] #65128: xar @1.8.0.487.100.1: error: variable-sized object may not be initialized

MacPorts noreply at macports.org
Sat May 7 18:48:47 UTC 2022


#65128: xar @1.8.0.487.100.1: error: variable-sized object may not be initialized
-------------------------+-------------------------------------------------
  Reporter:              |      Owner:  Schamschula
  barracuda156           |
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:  2.7.2
Resolution:              |   Keywords:  powerpc, tiger, leopard,
      Port:  xar         |  snowleopard
-------------------------+-------------------------------------------------

Comment (by kencu):

 Replying to [comment:19 ryandesign]:
 > Replying to [comment:14 Schamschula]:
 > > Hence, I tried setting {{{compiler.c_standard 2011}}}, which worked
 for all Intel and Apple SoC machines.
 >
 > What worked was removing `-std=c99`, returning clang to its default
 `-std=gnu99` mode; requiring a 2011 compiler does not seem to be relevant
 since c11 mode is not being enabled via `-std=c11`.

 using std=gnu99 doesn't make gcc11 happy:

 {{{
 $ cat arraytest1.c
 typedef unsigned int uint;

 int main(void) {
   const uint keys_to_ignore_count = 1;
   char * keys_to_ignore[keys_to_ignore_count] = { "id" }; // ID is allowed
 ot mismatch
   return (0);
 }

 $ /opt/local/bin/gcc-mp-11 -std=gnu99 -c arraytest1.c
 arraytest1.c: In function 'main':
 arraytest1.c:5:3: error: variable-sized object may not be initialized
     5 |   char * keys_to_ignore[keys_to_ignore_count] = { "id" }; // ID is
 allowed ot mismatch
       |   ^~~~
 }}}

 I haven't tried any other compilers.

-- 
Ticket URL: <https://trac.macports.org/ticket/65128#comment:20>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list