Opened 10 years ago

Closed 10 years ago

#6838 closed Bugs (fixed)

Adding include file with force_include makes Wave fail to emit #line directive

Reported by: Rasmus Bonnedal <rasmus.bonnedal@…> Owned by: Hartmut Kaiser
Milestone: To Be Determined Component: wave
Version: Boost 1.49.0 Severity: Problem
Keywords: wave force_include forceinclude #line Cc:

Description

It can be demonstrated with the wave tool:

Input files

a.cpp:

int main(void) return 0;

force.h:

int func(void);

Command line:

wave -F force.h a.cpp

Output:

#line 1 "/Users/bonnedr/code/boost-wave-test/force.h"
int func(void);

int main(void) { return 0; }

Expected output:

#line 1 "/Users/bonnedr/code/boost-wave-test/force.h"
int func(void);
#line 1 "/Users/bonnedr/code/boost-wave-test/a.cpp"
int main(void) { return 0; }

I have tried a fix by changing line 756 in wave/util/cpp_iterator.hpp like this. It solves the problem for me but I don't know Boost Wave enough to know if it doesn't introduce a bunch of other problems.

Fix:

-if (iter_ctx->emitted_lines+2 == act_pos.get_line()) {
+if (iter_ctx->emitted_lines+2 == act_pos.get_line() && act_pos.get_line() != 1) {

Change History (1)

comment:1 by Hartmut Kaiser, 10 years ago

Resolution: fixed
Status: newclosed

(In [78554]) Wave: Fixed #6838: Adding include file with force_include makes Wave fail to emit #line directive Added support for test of --forceinclude option to testwave executable, added test case verifying #6838 is fixed.

Note: See TracTickets for help on using tickets.