Skip to content

Commit

Permalink
Fix reporting missing #endif when there is no new line after #if or #…
Browse files Browse the repository at this point in the history
…else
  • Loading branch information
sabel83 committed Sep 18, 2017
1 parent a53b51e commit 9724612
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/boost/wave/util/cpp_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ bool returned_from_include_file = returned_from_include();
if (need_no_newline_at_end_of_file(ctx.get_language()))
{
seen_newline = true;
return act_token =
act_token =
typename pp_iterator_functor<ContextT>::result_type(
T_NEWLINE,
"\n",
Expand Down Expand Up @@ -710,7 +710,7 @@ bool returned_from_include_file = returned_from_include();
if (iter_ctx->first == iter_ctx->last)
{
seen_newline = true;
return act_token = result_type(T_NEWLINE, "\n", act_pos);
act_token = result_type(T_NEWLINE, "\n", act_pos);
}

// loop to the next token to analyze
Expand Down
14 changes: 14 additions & 0 deletions test/testwave/testfiles/t_7_004.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

//O --c++11

//E t_7_004.cpp(14): error: detected at least one missing #endif directive

#if 0
15 changes: 15 additions & 0 deletions test/testwave/testfiles/t_7_005.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

//O --c++11

//E t_7_005.cpp(15): error: detected at least one missing #endif directive

#if 0
#else
2 changes: 2 additions & 0 deletions test/testwave/testfiles/test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ t_6_069.cpp
t_7_001.cpp
t_7_002.cpp
t_7_003.cpp
t_7_004.cpp
t_7_005.cpp

#
# t_9: General preprocessing problems
Expand Down

0 comments on commit 9724612

Please sign in to comment.