Bug 62906 - Cannot compile table.cc with gcc 3.3.1
Summary: Cannot compile table.cc with gcc 3.3.1
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: general (show other bugs)
Version: 1.5 or before
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-18 21:11 UTC by Aaron Williams
Modified: 2003-08-20 00:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for table.cc in koffice-1.2.1 (1.48 KB, patch)
2003-08-20 00:13 UTC, Philippe Rigault
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Williams 2003-08-18 21:11:18 UTC
Version:           1.2.1 (using KDE KDE 3.1.3)
Installed from:    Compiled From Sourcescompiled sources
Compiler:          gcc 3.3.1 sparc solaris 2.7
OS:          SunOS (sun4u) release 5.8

table.cc: In member function `void Table::generateTopLineBorder(QTextStream&,
   int)':
table.cc:171: error: ISO C++ forbids variable-size array `border'
In file included from liblatexexport_la.all_cc.cc:16:
table.cc: In member function `void
   Table::generateBottomLineBorder(QTextStream&, int)':
table.cc:224: error: ISO C++ forbids variable-size array `border'
make[5]: *** [liblatexexport_la.all_cc.lo] Error 1
make[5]: Leaving directory `/net/max/export/max1/tools/kde_3.1/archive/3.1.3/koffice-1.2.1/filters/kword/latex/export'
make[4]: *** [all-recursive] Error 1
Comment 1 Philippe Rigault 2003-08-20 00:13:48 UTC
Created attachment 2280 [details]
Patch for table.cc in koffice-1.2.1

I got similar messages compiling koffice-1.3beta3 with gcc-3.3.1 today.
Here is what I found:

1. GCC behaviour changed between 3.2.1 and 3.3.1
   Variable-length arrays (an extension to GCC) used to produce a warning upon
compilation. They now produce an error and compilation (i.e 'make' stops).
Note that reporting an error is the right thing to do, so this is fixing a
faulty behaviour on GCC 3.2.

Example code producing this behaviour:

int getnb(void){
  int a=3;
  return a;
}

int main (int argc, char *argv[]) {
  bool a[getnb()];
  return 1;
}

With GCC 3.2.1:
$gcc -pedantic a.cc
a.cc: In function `int main(int, char**)':
a.cc:4: warning: ISO C++ forbids variable-size array `a'
$echo $?
0

With GCC 3.3.1:
$gcc -pedantic a.cc
a.cc: In function `int main(int, char**)':
a.cc:4: error: ISO C++ forbids variable-size array `a'
$echo $?
1

2. Koffice has fixed this PARTIALLY between koffice-1.2.1 and 1.3beta3
 a) The offending code in filters/kword/latex/export/table.cc has been fixed,
i.e the variable-length array has been replaced by a QBitArray.
   I include here a patch that should fix it in koffice-1.2.1 (there are other
modifications in this file between 1.2.1 and 1.3beta3, I include in the patch
only those related to fixing this bug).
 b) However, a NEW export filter has appeared in 1.3beta3 in
filters/kspread/latex/export/table.cc, and unfortunately this one still has the
faulty variable-length array.
For this last one, I have submitted a new bug report (because it affects
koffice-1.3beta3 and not 1.2.1) and a patch that fixes koffice-1.3beta3.
It is bug# 62984.
Comment 2 David Faure 2003-08-20 00:20:25 UTC
Subject: Re:  Cannot compile table.cc with gcc 3.3.1

On Wednesday 20 August 2003 00:13, you wrote:
> 2. Koffice has fixed this PARTIALLY between koffice-1.2.1 and 1.3beta3
>  a) The offending code in filters/kword/latex/export/table.cc has been fixed,
> i.e the variable-length array has been replaced by a QBitArray.
>    I include here a patch that should fix it in koffice-1.2.1

Thanks for that patch - it might be useful to some users.
However since there will be no new release of the 1.2-branch, there isn't
much point in applying this to CVS. What matters more is to fix the HEAD
branch (future 1.3).

>  b) However, a NEW export filter has appeared in 1.3beta3 in
> filters/kspread/latex/export/table.cc, and unfortunately this one still has the
> faulty variable-length array.
> For this last one, I have submitted a new bug report (because it affects
> koffice-1.3beta3 and not 1.2.1) and a patch that fixes koffice-1.3beta3.
> It is bug# 62984.

Thanks, I'll have a look.