From kdevelop-bugs Mon Dec 28 19:44:46 2009 From: =?UTF-8?Q?Perj=C3=A9ssy=20L=C3=B3r=C3=A1nt=20?= Date: Mon, 28 Dec 2009 19:44:46 +0000 To: kdevelop-bugs Subject: [Bug 220445] New: Syntax highlighter does not understand Message-Id: X-MARC-Message: https://marc.info/?l=kdevelop-bugs&m=126202959628424 https://bugs.kde.org/show_bug.cgi?id=220445 Summary: Syntax highlighter does not understand conditionally defined macros in read-only header files Product: kdevelop Version: 3.9.95 Platform: openSUSE RPMs OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: general AssignedTo: kdevelop-bugs@kdevelop.org ReportedBy: lostlont@freemail.hu Version: 3.9.95 (using KDE 4.3.1) OS: Linux Installed from: openSUSE RPMs The 3.9.95 version of KDevelop correctly highlights this code for me: // --- test.cpp --- #include #define DEF_CONDITION #ifdef DEF_CONDITION #define DEF_VALUE "Hello" #endif int main(int argc, char **argv) { std::cout << DEF_VALUE << std::endl; return 0; } // --- DEF_VALUE is known here. If I comment out the declaration of DEF_CONDITION the DEF_VALUE is correctly underlined where I use it. Then after removing the comment from the declaration the DEF_VALUE macro is known by the highlighter again. Though in this form: // --- header.h --- #ifdef DEF_CONDITION #define DEF_VALUE "Hello" #endif // --- test.cpp --- #include #define DEF_CONDITION #include "header.h" int main(int argc, char **argv) { std::cout << DEF_VALUE << std::endl; return 0; } // --- DEF_VALUE is only recognised by the syntax highlighter if the header.h file was saved *after* defining DEF_CONDITION in main.cpp. This already involves an unnecessary "header-resaving" constraint to let the highlighter know about DEF_VALUE but the problem is insolvable if the .h file is read-only by the user. A more concrete example: I try to use OpenGL extension functions defined in SDL_opengl.h system level header file but that requires specifying GL_GLEXT_PROTOTYPES before using the header: #define GL_GLEXT_PROTOTYPES 1 #include But the parser skips functions declared conditionally by this macro so it underlines the functions where I use them. The compiler works anyway, it's just an annoying thing that I see a lot of code lines containing underlined expressions though they are correct. -- Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. _______________________________________________ KDevelop-bugs mailing list KDevelop-bugs@kdevelop.org https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-bugs