Summary: | wrong behaviour of "reformat source" (C++) | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | elvio.amparore |
Component: | Astyle | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | prigault |
Priority: | NOR | ||
Version: | 3.0.0b1 | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
elvio.amparore
2003-11-22 21:32:38 UTC
Confirmed on Kdevelop-3.1.2 (KDE-3.3.2) Can't reproduce with kdevelop-3.1.1 from yoper. CORRECTION:
> Confirmed on Kdevelop-3.1.2 (KDE-3.3.2)
This is on KDE-3.3.2 compiled from sources (gcc-3.3.3) on Fedora Core 1.
When I use the same sources (kdevelop-3.1.2 on KDE-3.3.2) compiled (gcc-3.4.2) on Fedora Core 3, the bug does *not* happen (i.e formatting works OK).
So what you are saying is that astyle has a bug with gcc < 3.4.2 ? > So what you are saying is that astyle has a bug with gcc < 3.4.2 ?
From the symptoms, it looks like it, but I looked into this further and did not reach conclusive evidence yet.
I downloaded astyle_1.15.3 from sourceforge and tested it on:
A) Fedora Core 1 box (i686) with gcc-3.3.3
B) Fedora Core 3 box (i686) with gcc-3.4.2
A) astyle compiles fine. Consistently shows the bug
1. astyle --style=gnu testcase.cc (same with --style=kr and --style=ansi)
if (pt.y>
=minY && pt.y<=maxY && pt.x>=minX && pt.x<=maxX)
2. astyle --style=linux testcase.cc
if (pt.y>
=minY && pt.y<=maxY && pt.x>=minX && pt.x<=maxX)
B) astyle does not compile with gcc-3.4.2 (which is correct behaviour, because astyle_main.cpp should not compile):
$ make
g++ -Wall -Wno-sign-compare -O2 -c ASResource.cpp
g++ -Wall -Wno-sign-compare -O2 -c ASBeautifier.cpp
g++ -Wall -Wno-sign-compare -O2 -c ASFormatter.cpp
g++ -Wall -Wno-sign-compare -O2 -c astyle_main.cpp
astyle_main.cpp: In function `bool parseOptions(astyle::ASFormatter&, const ITER&, const ITER&, const std::string&)':
astyle_main.cpp:178: error: there are no arguments to `parseOption' that depend on a template parameter, so a declaration of `parseOption' must be available
astyle_main.cpp:178: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
astyle_main.cpp:183: error: there are no arguments to `parseOption' that depend on a template parameter, so a declaration of `parseOption' must be available
astyle_main.cpp:188: error: there are no arguments to `parseOption' that depend on a template parameter, so a declaration of `parseOption' must be available
make: *** [astyle_main.o] Error 1
Declaring properly the function (i.e inserting the following line before line 154 in astyle_main.cpp) is necessary to get astyle to compile.
bool parseOption(ASFormatter &formatter, const string &arg, const string &errorInfo);
Then, I gave it the testcase, and it showed the exact same behaviour as on A.
Then I realized that:
- the astyle classes distributed in kdevelop differ from those of astyle_1.15.3 (which version are they by the way?). Replace the classes ASBeautifier.cpp, ASFormatter.cpp and ASResource.cpp. Same result, bug shows up in command-line astyle on gcc-3.4.2.
- kdevelop has its own wrapper instead of astyle_main.cpp
So there is more work ahead to explain why I am seeing it with gcc-3.3.3 and not with gcc-3.4.2. By the way, I have two build of FC3/gcc-3.4.2: one on i386 and one on x86_64, and the bug happens on neihter of them.
Fixed in the KDevelop 3.4 branch as part of this commit: SVN commit 595657 by dymo: Applied patch from Megan Webb: Update to the astyle plugin to use astyle v1.19 Changes: - layout of the formatting dialog has changed to mirror the astyle command line options help. - all options from commandline astyle can be set. - interactive display of most options selected. - tooltips for all options |