Bug 77767 - Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Sources: kdevelop/kwrite/kwdialog.h isn't compatible with ANSI C++
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: kdevelop (Show other bugs)
7.3
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Ngo Than
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-13 05:36 EST by Sysoltsev Slawa
Modified: 2007-04-18 12:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-26 10:27:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch doing <kwdialog.h> ANSI C++ compatible (#include added) (253 bytes, patch)
2002-11-13 05:43 EST, Sysoltsev Slawa
no flags Details | Diff

  None (edit)
Description Sysoltsev Slawa 2002-11-13 05:36:01 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
Compiling kdevelop source by Intel C/C++ compiler I've received such error 
message:

c++ -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/include/kde -I/usr/lib/qt3-
gcc2.96/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-
virtual-dtor -Wno-long-long -Wbad-function-cast -Wundef -Wall -pedantic -W -
Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -
D_BSD_SOURCE -Wcast-align -Wconversion -fno-builtin -g -O2 -O2 -march=i386 -
mcpu=i686 -DNDEBUG -DNO_DEBUG -D_GNU_SOURCE -fno-exceptions -fno-check-new -
ftemplate-depth-99 -Wp,-MD,.deps/kwview.pp -c kwview.cpp  -fPIC -DPIC
kwdialog.h(29): error: identifier "QComboBox" is undefined
      QComboBox *search;
      ^

kwdialog.h(30): error: identifier "QComboBox" is undefined
      QComboBox *replace;
      ^

compilation aborted for kwview.cpp (code 2)

Problem here is that "-ansi -pedantic" comand-line options cause strict ANSI 
C++ checking. According to ANSI C++, code in kwdialog.h is illegal, because 
class QComboBox isn't declared evidently in included Qt headers (you forgot 
<qcombobox.h>) and declared only in class QListBoxItem (qlistbox.h) as friend 
class - you can ensure in it looking preprocessed file. This is enough for C++ 
without ANSI check but no enough for strict ANSI dialect. Look at section 11.4 
paragraph 2 of the C++ standart: "A class shall not be defined in a friend 
declaration.", also paragraph 7: "A name nominated by a friend declaration 
shall be accessible in the scope of the class containing the friend 
declaration."
GNU C/C++ compiler doesn't do really STRICT ANSI check so illegal code passes 
thru it successfully. But to increase Red Hat Linux portability you should 
correct code in <kwdialog.h> conforming ANSI C++ standart. Workaround here is 
add #include <qcombobox.h> to list of kwdialog.h includes. I'll attach the 
patch with this modification - please look at it.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. I'm afraid you won't be able to reproduce the error because you don't have 
compiler I used and this error doesn't appear with current GNU C/C++ compiler.
	

Actual Results:  Compilation error.

Expected Results:  Biult package.

Additional info:
Comment 1 Sysoltsev Slawa 2002-11-13 05:43:29 EST
Created attachment 84784 [details]
Patch doing <kwdialog.h> ANSI C++ compatible (#include added)
Comment 2 Ngo Than 2003-01-26 10:27:50 EST
it's fixed in 2.1.5-1. thanks for your patch file.

Note You need to log in before you can comment on or make changes to this bug.