Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0009468 [GCC-XML] major always 2009-09-01 03:54 2009-09-01 09:49
Reporter edice View Status public  
Assigned To Brad King
Priority normal Resolution fixed  
Status closed  
Summary 0009468: Quote include behaviour not correct
Description Attached is a tarball with the following test project structure:
./dir_a
./dir_a/a.hpp
./dir_a/common_name.hpp
./dir_b
./dir_b/b.hpp
./dir_b/common_name.hpp
./main.cpp
./demonstrate.sh
./preprocessed_gcc.log
./preprocessed_gccxml.log


main.cpp #includes "dir_a/a.hpp" and "dir_b/b.hpp" which works fine.
Both a.hpp and b.hpp both have:
#include "common_name.hpp"
Which is also fine, both will include their respective local common_name.hpp file.

However, gccxml will always include dir_a/common_name.hpp, which is not consistent with gcc.

There is a little script "demonstrate.sh" which runs the compilers and demonstrates the problems. It also generates some log files with the preprocessed code (log files included in tarball).

This is the output of the script:
$ ./demonstrate.sh
Using gcc preprocessor to generate correct code. Results in preprocessed_gcc.log
Using gccxml and preprocessor - will show INCORRECT code. Results in preprocessed_gccxml.log. NOTE THAT dir_a/common_name.hpp is included when dir_b should've been included.
main.cpp:8:2: error: #error "Did not include b/common_name.hpp"
Using gcc plain - will pass
Using gccxml - will fail
main.cpp:8:2: error: #error "Did not include b/common_name.hpp"



And this is the key part of preprocessed_gccxml.log, with a note on where the problem happens:


# 1 "main.cpp"
# 1 "dir_a/a.hpp" 1
# 1 "dir_a/common_name.hpp" 1
#define HELLO_A
# 1 "dir_a/a.hpp" 2
# 2 "main.cpp" 2
# 1 "dir_b/b.hpp" 1
# 1 "dir_a/common_name.hpp" 1 <--- should have included dir_b/common_name.hpp
#define HELLO_A <--- therefore, incorrect #define
# 1 "dir_b/b.hpp" 2
# 3 "main.cpp" 2
# 11 "main.cpp"
int main()
{
   return 0;
}



This is what it looked like from gcc's preprocessor:
# 1 "main.cpp"
# 1 "dir_a/a.hpp" 1
# 1 "dir_a/common_name.hpp" 1
#define HELLO_A
# 1 "dir_a/a.hpp" 2
# 2 "main.cpp" 2
# 1 "dir_b/b.hpp" 1
# 1 "dir_b/common_name.hpp" 1 <--- the correct file :)
#define HELLO_B <--- the correct #define
# 1 "dir_b/b.hpp" 2
# 3 "main.cpp" 2
# 11 "main.cpp"
int main()
{
   return 0;
}
Additional Information
Tags No tags attached.
Attached Files gz file icon gccxml_test.tar.gz [^] (3,211 bytes) 2009-09-01 03:54

- Relationships Relation Graph ] Dependency Graph ]
related to 0006682closedBrad King Quote vs bracket include behaviour not correct 

-  Notes
(0017262)
edice (reporter)
2009-09-01 04:00

This is probably related to issue 0006682
(0017268)
Brad King (manager)
2009-09-01 09:49

Fixed.

Disable preprocessor include search cache
/cvsroot/GCC_XML/gccxml/GCC/libcpp/files.c,v <-- GCC/libcpp/files.c
new revision: 1.4; previous revision: 1.3

- Issue History
Date Modified Username Field Change
2009-09-01 03:54 edice New Issue
2009-09-01 03:54 edice File Added: gccxml_test.tar.gz
2009-09-01 03:59 edice Issue Monitored: edice
2009-09-01 04:00 edice Note Added: 0017262
2009-09-01 09:01 Brad King Relationship added related to 0006682
2009-09-01 09:49 Brad King Note Added: 0017268
2009-09-01 09:49 Brad King Status new => assigned
2009-09-01 09:49 Brad King Assigned To => Brad King
2009-09-01 09:49 Brad King Status assigned => closed
2009-09-01 09:49 Brad King Resolution open => fixed


Mantis 1.1.4[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker