|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80761 - in trunk: boost/wave boost/wave/cpplexer boost/wave/cpplexer/re2clex libs/wave libs/wave/src/cpplexer/re2clex tools/wave
From: hartmut.kaiser_at_[hidden]
Date: 2012-09-29 16:13:29
Author: hkaiser
Date: 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
New Revision: 80761
URL: http://svn.boost.org/trac/boost/changeset/80761
Log:
Wave: fixing a couple of warnings
Text files modified:
trunk/boost/wave/cpp_exceptions.hpp | 52 ++++++++++----------
trunk/boost/wave/cpp_iteration_context.hpp | 4
trunk/boost/wave/cpplexer/cpplexer_exceptions.hpp | 46 +++++++++---------
trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp | 96 ++++++++++++++++++++--------------------
trunk/boost/wave/cpplexer/re2clex/scanner.hpp | 16 +++---
trunk/boost/wave/cpplexer/validate_universal_char.hpp | 94 +++++++++++++++++++-------------------
trunk/libs/wave/ChangeLog | 3 +
trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp | 54 +++++++++++-----------
trunk/tools/wave/trace_macro_expansion.hpp | 4
9 files changed, 186 insertions(+), 183 deletions(-)
Modified: trunk/boost/wave/cpp_exceptions.hpp
==============================================================================
--- trunk/boost/wave/cpp_exceptions.hpp (original)
+++ trunk/boost/wave/cpp_exceptions.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -42,11 +42,11 @@
severity_commandline_error,
last_severity_code = severity_commandline_error
};
-
+
inline char const *
- get_severity(int level)
+ get_severity(int level)
{
- static char const *severity_text[] =
+ static char const *severity_text[] =
{
"remark", // severity_remark
"warning", // severity_warning
@@ -54,20 +54,20 @@
"fatal error", // severity_fatal
"command line error" // severity_commandline_error
};
- BOOST_ASSERT(severity_remark <= level &&
+ BOOST_ASSERT(severity_remark <= level &&
level <= last_severity_code);
return severity_text[level];
}
}
///////////////////////////////////////////////////////////////////////////////
-// cpp_exception, the base class for all specific C preprocessor exceptions
+// cpp_exception, the base class for all specific C preprocessor exceptions
class BOOST_SYMBOL_VISIBLE cpp_exception
: public std::exception
{
public:
- cpp_exception(int line_, int column_, char const *filename_) throw()
- : line(line_), column(column_)
+ cpp_exception(std::size_t line_, std::size_t column_, char const *filename_) throw()
+ : line(line_), column(column_)
{
unsigned int off = 0;
while (off < sizeof(filename)-1 && *filename_)
@@ -75,22 +75,22 @@
filename[off] = 0;
}
~cpp_exception() throw() {}
-
+
virtual char const *what() const throw() = 0; // to be overloaded
virtual char const *description() const throw() = 0;
virtual int get_errorcode() const throw() = 0;
virtual int get_severity() const throw() = 0;
virtual char const* get_related_name() const throw() = 0;
virtual bool is_recoverable() const throw() = 0;
-
- int line_no() const throw() { return line; }
- int column_no() const throw() { return column; }
+
+ std::size_t line_no() const throw() { return line; }
+ std::size_t column_no() const throw() { return column; }
char const *file_name() const throw() { return filename; }
-
+
protected:
char filename[512];
- int line;
- int column;
+ std::size_t line;
+ std::size_t column;
};
///////////////////////////////////////////////////////////////////////////////
@@ -149,9 +149,9 @@
last_error_number = pragma_message_directive
};
- preprocess_exception(char const *what_, error_code code, int line_,
- int column_, char const *filename_) throw()
- : cpp_exception(line_, column_, filename_),
+ preprocess_exception(char const *what_, error_code code, std::size_t line_,
+ std::size_t column_, char const *filename_) throw()
+ : cpp_exception(line_, column_, filename_),
code(code)
{
unsigned int off = 0;
@@ -160,7 +160,7 @@
buffer[off] = 0;
}
~preprocess_exception() throw() {}
-
+
virtual char const *what() const throw()
{
return "boost::wave::preprocess_exception";
@@ -184,7 +184,7 @@
virtual bool is_recoverable() const throw()
{
switch (get_errorcode()) {
- // these are the exceptions thrown during processing not supposed to
+ // these are the exceptions thrown during processing not supposed to
// produce any tokens on the context::iterator level
case preprocess_exception::no_error: // just a placeholder
case preprocess_exception::macro_redefinition:
@@ -221,7 +221,7 @@
case preprocess_exception::ill_formed_pragma_message:
case preprocess_exception::pragma_message_directive:
return true;
-
+
case preprocess_exception::unexpected_error:
case preprocess_exception::ill_formed_operator:
case preprocess_exception::too_few_macroarguments:
@@ -234,7 +234,7 @@
}
return false;
}
-
+
static char const *error_text(int code)
{
// error texts in this array must appear in the same order as the items in
@@ -370,8 +370,8 @@
public preprocess_exception
{
public:
- macro_handling_exception(char const *what_, error_code code, int line_,
- int column_, char const *filename_, char const *macroname) throw()
+ macro_handling_exception(char const *what_, error_code code, std::size_t line_,
+ std::size_t column_, char const *filename_, char const *macroname) throw()
: preprocess_exception(what_, code, line_, column_, filename_)
{
unsigned int off = 0;
@@ -380,7 +380,7 @@
name[off] = 0;
}
~macro_handling_exception() throw() {}
-
+
virtual char const *what() const throw()
{
return "boost::wave::macro_handling_exception";
@@ -396,10 +396,10 @@
///////////////////////////////////////////////////////////////////////////////
//
-// The is_recoverable() function allows to decide, whether it is possible
+// The is_recoverable() function allows to decide, whether it is possible
// simply to continue after a given exception was thrown by Wave.
//
-// This is kind of a hack to allow to recover from certain errors as long as
+// This is kind of a hack to allow to recover from certain errors as long as
// Wave doesn't provide better means of error recovery.
//
///////////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/wave/cpp_iteration_context.hpp
==============================================================================
--- trunk/boost/wave/cpp_iteration_context.hpp (original)
+++ trunk/boost/wave/cpp_iteration_context.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -124,8 +124,8 @@
BOOST_WAVE_STRINGTYPE real_filename; // real name of the current file
BOOST_WAVE_STRINGTYPE real_relative_filename; // real relative name of the current file
BOOST_WAVE_STRINGTYPE filename; // actual processed file
- unsigned int line; // line counter of underlying stream
- unsigned int emitted_lines; // count of emitted newlines
+ std::size_t line; // line counter of underlying stream
+ std::size_t emitted_lines; // count of emitted newlines
std::size_t if_block_depth; // depth of #if block recursion
ContextT& ctx; // corresponding context<> object
file_type type; // the type of the handled file
Modified: trunk/boost/wave/cpplexer/cpplexer_exceptions.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpplexer_exceptions.hpp (original)
+++ trunk/boost/wave/cpplexer/cpplexer_exceptions.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -110,11 +110,11 @@
severity_error,
severity_fatal
};
-
+
inline char const *
- get_severity(severity level)
+ get_severity(severity level)
{
- static char const *severity_text[] =
+ static char const *severity_text[] =
{
"remark", // severity_remark
"warning", // severity_warning
@@ -127,13 +127,13 @@
}
///////////////////////////////////////////////////////////////////////////////
-// cpplexer_exception, the base class for all specific C++ lexer exceptions
+// cpplexer_exception, the base class for all specific C++ lexer exceptions
class BOOST_SYMBOL_VISIBLE cpplexer_exception
: public std::exception
{
public:
- cpplexer_exception(int line_, int column_, char const *filename_) throw()
- : line(line_), column(column_)
+ cpplexer_exception(std::size_t line_, std::size_t column_, char const *filename_) throw()
+ : line(line_), column(column_)
{
unsigned int off = 0;
while (off < sizeof(filename)-1 && *filename_)
@@ -141,21 +141,21 @@
filename[off] = 0;
}
~cpplexer_exception() throw() {}
-
+
virtual char const *what() const throw() = 0; // to be overloaded
virtual char const *description() const throw() = 0;
virtual int get_errorcode() const throw() = 0;
virtual int get_severity() const throw() = 0;
virtual bool is_recoverable() const throw() = 0;
- int line_no() const throw() { return line; }
- int column_no() const throw() { return column; }
+ std::size_t line_no() const throw() { return line; }
+ std::size_t column_no() const throw() { return column; }
char const *file_name() const throw() { return filename; }
-
+
protected:
char filename[512];
- int line;
- int column;
+ std::size_t line;
+ std::size_t column;
};
///////////////////////////////////////////////////////////////////////////////
@@ -174,9 +174,9 @@
generic_lexing_warning = 6
};
- lexing_exception(char const *what_, error_code code, int line_,
- int column_, char const *filename_) throw()
- : cpplexer_exception(line_, column_, filename_),
+ lexing_exception(char const *what_, error_code code, std::size_t line_,
+ std::size_t column_, char const *filename_) throw()
+ : cpplexer_exception(line_, column_, filename_),
level(severity_level(code)), code(code)
{
unsigned int off = 0;
@@ -185,7 +185,7 @@
buffer[off] = 0;
}
~lexing_exception() throw() {}
-
+
virtual char const *what() const throw()
{
return "boost::wave::lexing_exception";
@@ -212,14 +212,14 @@
case lexing_exception::generic_lexing_warning:
case lexing_exception::generic_lexing_error:
return true; // for now allow all exceptions to be recoverable
-
+
case lexing_exception::unexpected_error:
default:
break;
}
return false;
}
-
+
static char const *error_text(int code)
{
// error texts in this array must appear in the same order as the items in
@@ -229,7 +229,7 @@
"universal character name specifies an invalid character", // universal_char_invalid
"a universal character name cannot designate a character in the "
"basic character set", // universal_char_base_charset
- "this universal character is not allowed in an identifier", // universal_char_not_allowed
+ "this universal character is not allowed in an identifier", // universal_char_not_allowed
"long long suffixes are not allowed in pure C++ mode, "
"enable long_long mode to allow these", // invalid_long_long_literal
"generic lexer error", // generic_lexing_error
@@ -246,7 +246,7 @@
util::severity_error, // universal_char_base_charset
util::severity_error, // universal_char_not_allowed
util::severity_warning, // invalid_long_long_literal
- util::severity_error, // generic_lexing_error
+ util::severity_error, // generic_lexing_error
util::severity_warning // invalid_long_long_literal
};
return preprocess_exception_severity[code];
@@ -264,10 +264,10 @@
///////////////////////////////////////////////////////////////////////////////
//
-// The is_recoverable() function allows to decide, whether it is possible
+// The is_recoverable() function allows to decide, whether it is possible
// simply to continue after a given exception was thrown by Wave.
//
-// This is kind of a hack to allow to recover from certain errors as long as
+// This is kind of a hack to allow to recover from certain errors as long as
// Wave doesn't provide better means of error recovery.
//
///////////////////////////////////////////////////////////////////////////////
@@ -280,7 +280,7 @@
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
-} // namespace boost
+} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS
Modified: trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp (original)
+++ trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -54,21 +54,21 @@
namespace re2clex {
///////////////////////////////////////////////////////////////////////////////
-//
+//
// encapsulation of the re2c based cpp lexer
//
///////////////////////////////////////////////////////////////////////////////
-template <typename IteratorT,
+template <typename IteratorT,
typename PositionT = boost::wave::util::file_position_type,
typename TokenT = lex_token<PositionT> >
-class lexer
+class lexer
{
public:
typedef TokenT token_type;
typedef typename token_type::string_type string_type;
- lexer(IteratorT const &first, IteratorT const &last,
+ lexer(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language_);
~lexer();
@@ -82,9 +82,9 @@
scanner.file_name = filename.c_str();
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- bool has_include_guards(std::string& guard_name) const
- {
- return guards.detected(guard_name);
+ bool has_include_guards(std::string& guard_name) const
+ {
+ return guards.detected(guard_name);
}
#endif
@@ -111,12 +111,12 @@
};
///////////////////////////////////////////////////////////////////////////////
-// initialize cpp lexer
+// initialize cpp lexer
template <typename IteratorT, typename PositionT, typename TokenT>
inline
-lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
- IteratorT const &last, PositionT const &pos,
- boost::wave::language_support language_)
+lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
+ IteratorT const &last, PositionT const &pos,
+ boost::wave::language_support language_)
: filename(pos.get_file()), at_eof(false), language(language_)
#if BOOST_WAVE_SUPPORT_THREADING != 0
, cache()
@@ -127,7 +127,7 @@
scanner.eol_offsets = aq_create();
if (first != last) {
scanner.first = scanner.act = (uchar *)&(*first);
- scanner.last = scanner.first + std::distance(first, last);
+ scanner.last = scanner.first + std::distance(first, last);
}
scanner.line = pos.get_line();
scanner.column = scanner.curr_column = pos.get_column();
@@ -162,7 +162,7 @@
template <typename IteratorT, typename PositionT, typename TokenT>
inline
-lexer<IteratorT, PositionT, TokenT>::~lexer()
+lexer<IteratorT, PositionT, TokenT>::~lexer()
{
using namespace std; // some systems have free in std
aq_terminate(scanner.eol_offsets);
@@ -175,31 +175,31 @@
inline TokenT&
lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
{
- if (at_eof)
+ if (at_eof)
return result = token_type(); // return T_EOI
- unsigned int actline = scanner.line;
+ std::size_t actline = scanner.line;
token_id id = token_id(scan(&scanner));
switch (static_cast<unsigned int>(id)) {
case T_IDENTIFIER:
// test identifier characters for validity (throws if invalid chars found)
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (!boost::wave::need_no_character_validation(language))
- impl::validate_identifier_name(value, actline, scanner.column, filename);
+ impl::validate_identifier_name(value, actline, scanner.column, filename);
break;
case T_STRINGLIT:
case T_CHARLIT:
case T_RAWSTRINGLIT:
// test literal characters for validity (throws if invalid chars found)
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (boost::wave::need_convert_trigraphs(language))
- value = impl::convert_trigraphs(value);
+ value = impl::convert_trigraphs(value);
if (!boost::wave::need_no_character_validation(language))
- impl::validate_literal(value, actline, scanner.column, filename);
+ impl::validate_literal(value, actline, scanner.column, filename);
break;
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
@@ -208,7 +208,7 @@
case T_PP_INCLUDE:
// convert to the corresponding ..._next token, if appropriate
{
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
// Skip '#' and whitespace and see whether we find an 'include_next' here.
@@ -220,11 +220,11 @@
#endif
case T_LONGINTLIT: // supported in C++11, C99 and long_long mode
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
if (!boost::wave::need_long_long(language)) {
// syntax error: not allowed in C++ mode
- BOOST_WAVE_LEXER_THROW(lexing_exception, invalid_long_long_literal,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, invalid_long_long_literal,
value.c_str(), actline, scanner.column, filename.c_str());
}
break;
@@ -241,7 +241,7 @@
case T_SPACE2:
case T_ANY:
case T_PP_NUMBER:
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
break;
@@ -264,7 +264,7 @@
value = cache.get_token_value(BASEID_FROM_TOKEN(id));
}
else {
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
break;
@@ -272,10 +272,10 @@
case T_ANY_TRIGRAPH:
if (boost::wave::need_convert_trigraphs(language)) {
value = impl::convert_trigraph(
- string_type((char const *)scanner.tok));
+ string_type((char const *)scanner.tok));
}
else {
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
break;
@@ -284,7 +284,7 @@
if (CATEGORY_FROM_TOKEN(id) != EXTCATEGORY_FROM_TOKEN(id) ||
IS_CATEGORY(id, UnknownTokenType))
{
- value = string_type((char const *)scanner.tok,
+ value = string_type((char const *)scanner.tok,
scanner.cur-scanner.tok);
}
else {
@@ -306,8 +306,8 @@
}
template <typename IteratorT, typename PositionT, typename TokenT>
-inline int
-lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
+inline int
+lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
char const *msg, ...)
{
BOOST_ASSERT(0 != s);
@@ -321,28 +321,28 @@
vsprintf(buffer, msg, params);
va_end(params);
- BOOST_WAVE_LEXER_THROW_VAR(lexing_exception, errcode, buffer, s->line,
+ BOOST_WAVE_LEXER_THROW_VAR(lexing_exception, errcode, buffer, s->line,
s->column, s->file_name);
// BOOST_UNREACHABLE_RETURN(0);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
-//
+//
// lex_functor
-//
+//
///////////////////////////////////////////////////////////////////////////////
-template <typename IteratorT,
+template <typename IteratorT,
typename PositionT = boost::wave::util::file_position_type,
typename TokenT = typename lexer<IteratorT, PositionT>::token_type>
-class lex_functor
+class lex_functor
: public lex_input_interface_generator<TokenT>
{
public:
typedef TokenT token_type;
- lex_functor(IteratorT const &first, IteratorT const &last,
+ lex_functor(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language)
: re2c_lexer(first, last, pos, language)
{}
@@ -352,7 +352,7 @@
token_type& get(token_type& result) { return re2c_lexer.get(result); }
void set_position(PositionT const &pos) { re2c_lexer.set_position(pos); }
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- bool has_include_guards(std::string& guard_name) const
+ bool has_include_guards(std::string& guard_name) const
{ return re2c_lexer.has_include_guards(guard_name); }
#endif
@@ -364,16 +364,16 @@
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename PositionT, typename TokenT>
token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type> const
- lexer<IteratorT, PositionT, TokenT>::cache =
+ lexer<IteratorT, PositionT, TokenT>::cache =
token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type>();
#endif
} // namespace re2clex
///////////////////////////////////////////////////////////////////////////////
-//
+//
// The new_lexer_gen<>::new_lexer function (declared in cpp_lex_interface.hpp)
-// should be defined inline, if the lex_functor shouldn't be instantiated
+// should be defined inline, if the lex_functor shouldn't be instantiated
// separately from the lex_iterator.
//
// Separate (explicit) instantiation helps to reduce compilation time.
@@ -384,21 +384,21 @@
#define BOOST_WAVE_RE2C_NEW_LEXER_INLINE
#else
#define BOOST_WAVE_RE2C_NEW_LEXER_INLINE inline
-#endif
+#endif
///////////////////////////////////////////////////////////////////////////////
//
// The 'new_lexer' function allows the opaque generation of a new lexer object.
-// It is coupled to the iterator type to allow to decouple the lexer/iterator
+// It is coupled to the iterator type to allow to decouple the lexer/iterator
// configurations at compile time.
//
-// This function is declared inside the cpp_lex_token.hpp file, which is
+// This function is declared inside the cpp_lex_token.hpp file, which is
// referenced by the source file calling the lexer and the source file, which
-// instantiates the lex_functor. But is is defined here, so it will be
-// instantiated only while compiling the source file, which instantiates the
+// instantiates the lex_functor. But is is defined here, so it will be
+// instantiated only while compiling the source file, which instantiates the
// lex_functor. While the cpp_re2c_token.hpp file may be included everywhere,
// this file (cpp_re2c_lexer.hpp) should be included only once. This allows
-// to decouple the lexer interface from the lexer implementation and reduces
+// to decouple the lexer interface from the lexer implementation and reduces
// compilation time.
//
///////////////////////////////////////////////////////////////////////////////
@@ -407,7 +407,7 @@
BOOST_WAVE_RE2C_NEW_LEXER_INLINE
lex_input_interface<TokenT> *
new_lexer_gen<IteratorT, PositionT, TokenT>::new_lexer(IteratorT const &first,
- IteratorT const &last, PositionT const &pos,
+ IteratorT const &last, PositionT const &pos,
boost::wave::language_support language)
{
using re2clex::lex_functor;
@@ -419,7 +419,7 @@
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
-} // namespace boost
+} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS
Modified: trunk/boost/wave/cpplexer/re2clex/scanner.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/re2clex/scanner.hpp (original)
+++ trunk/boost/wave/cpplexer/re2clex/scanner.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -4,8 +4,8 @@
http://www.boost.org/
Copyright (c) 2001 Daniel C. Nuffer.
- Copyright (c) 2001-2012 Hartmut Kaiser.
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ Copyright (c) 2001-2012 Hartmut Kaiser.
+ 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)
=============================================================================*/
@@ -28,7 +28,7 @@
struct Scanner;
typedef unsigned char uchar;
-typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
+typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
char const *, ...);
typedef struct Scanner {
@@ -37,7 +37,7 @@
uchar* last; /* end (one past last char) of input buffer */
uchar* bot; /* beginning of the current buffer */
uchar* top; /* top of the current buffer */
- uchar* eof; /* when we read in the last buffer, will point 1 past the
+ uchar* eof; /* when we read in the last buffer, will point 1 past the
end of the file, otherwise 0 */
uchar* tok; /* points to the beginning of the current token */
uchar* ptr; /* used for YYMARKER - saves backtracking info */
@@ -45,10 +45,10 @@
uchar* lim; /* used for YYLIMIT - points to the end of the buffer */
/* (lim == top) except for the last buffer, it points to
the end of the input (lim == eof - 1) */
- unsigned int line; /* current line being lex'ed */
- unsigned int column; /* current token start column position */
- unsigned int curr_column; /* current column position */
- ReportErrorProc error_proc; /* must be != 0, this function is called to
+ std::size_t line; /* current line being lex'ed */
+ std::size_t column; /* current token start column position */
+ std::size_t curr_column; /* current column position */
+ ReportErrorProc error_proc; /* must be != 0, this function is called to
report an error */
char const *file_name; /* name of the lex'ed file */
aq_queue eol_offsets;
Modified: trunk/boost/wave/cpplexer/validate_universal_char.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/validate_universal_char.hpp (original)
+++ trunk/boost/wave/cpplexer/validate_universal_char.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Grammar for universal character validation (see C++ standard: Annex E)
-
+
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -37,12 +37,12 @@
};
///////////////////////////////////////////////////////////////////////////
-//
-// is_range is a helper function for the classification by brute force
+//
+// is_range is a helper function for the classification by brute force
// below
//
///////////////////////////////////////////////////////////////////////////
-inline bool
+inline bool
in_range(unsigned long ch, unsigned long l, unsigned long u)
{
return (l <= ch && ch <= u);
@@ -67,15 +67,15 @@
// Implementation note:
// This classification isn't implemented very effectively here. This
// function should be rewritten with some range run matching algorithm.
-//
+//
///////////////////////////////////////////////////////////////////////////////
-inline universal_char_type
+inline universal_char_type
classify_universal_char (unsigned long ch)
{
// test for invalid characters
if (ch <= 0x0020 || in_range(ch, 0x007f, 0x009f))
return universal_char_type_invalid;
-
+
// test for characters in the range of the base character set
if (in_range(ch, 0x0021, 0x005f) || in_range(ch, 0x0061, 0x007e))
return universal_char_type_base_charset;
@@ -88,7 +88,7 @@
{
return universal_char_type_valid; // Latin
}
-
+
if (0x0384 == ch || in_range(ch, 0x0388, 0x038a) ||
0x038c == ch || in_range(ch, 0x038e, 0x03a1) ||
in_range(ch, 0x03a3, 0x03ce) || in_range(ch, 0x03d0, 0x03d6) ||
@@ -96,7 +96,7 @@
in_range(ch, 0x03e2, 0x03f3) || in_range(ch, 0x1f00, 0x1f15) ||
in_range(ch, 0x1f18, 0x1f1d) || in_range(ch, 0x1f20, 0x1f45) ||
in_range(ch, 0x1f48, 0x1f4d) || in_range(ch, 0x1f50, 0x1f57) ||
- 0x1f59 == ch || 0x1f5b == ch || 0x1f5d == ch ||
+ 0x1f59 == ch || 0x1f5b == ch || 0x1f5d == ch ||
in_range(ch, 0x1f5f, 0x1f7d) || in_range(ch, 0x1f80, 0x1fb4) ||
in_range(ch, 0x1fb6, 0x1fbc) || in_range(ch, 0x1fc2, 0x1fc4) ||
in_range(ch, 0x1fc6, 0x1fcc) || in_range(ch, 0x1fd0, 0x1fd3) ||
@@ -105,7 +105,7 @@
{
return universal_char_type_valid; // Greek
}
-
+
if (in_range(ch, 0x0401, 0x040d) || in_range(ch, 0x040f, 0x044f) ||
in_range(ch, 0x0451, 0x045c) || in_range(ch, 0x045e, 0x0481) ||
in_range(ch, 0x0490, 0x04c4) || in_range(ch, 0x04c7, 0x04c8) ||
@@ -114,20 +114,20 @@
{
return universal_char_type_valid; // Cyrillic
}
-
+
if (in_range(ch, 0x0531, 0x0556) || in_range(ch, 0x0561, 0x0587))
return universal_char_type_valid; // Armenian
if (in_range(ch, 0x05d0, 0x05ea) || in_range(ch, 0x05f0, 0x05f4))
return universal_char_type_valid; // Hebrew
-
+
if (in_range(ch, 0x0621, 0x063a) || in_range(ch, 0x0640, 0x0652) ||
in_range(ch, 0x0670, 0x06b7) || in_range(ch, 0x06ba, 0x06be) ||
in_range(ch, 0x06c0, 0x06ce) || in_range(ch, 0x06e5, 0x06e7))
{
return universal_char_type_valid; // Arabic
}
-
+
if (in_range(ch, 0x0905, 0x0939) || in_range(ch, 0x0958, 0x0962))
return universal_char_type_valid; // Devanagari
@@ -139,7 +139,7 @@
{
return universal_char_type_valid; // Bengali
}
-
+
if (in_range(ch, 0x0a05, 0x0a0a) || in_range(ch, 0x0a0f, 0x0a10) ||
in_range(ch, 0x0a13, 0x0a28) || in_range(ch, 0x0a2a, 0x0a30) ||
in_range(ch, 0x0a32, 0x0a33) || in_range(ch, 0x0a35, 0x0a36) ||
@@ -209,49 +209,49 @@
// validate_identifier_name
//
// The validate_identifier_name function tests a given identifier name for
-// its validity with regard to eventually contained universal characters.
-// These should be in valid ranges (see the function
+// its validity with regard to eventually contained universal characters.
+// These should be in valid ranges (see the function
// classify_universal_char above).
//
-// If the identifier name contains invalid or not allowed universal
+// If the identifier name contains invalid or not allowed universal
// characters a corresponding lexing_exception is thrown.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
-inline void
-validate_identifier_name (StringT const &name, int line, int column,
- StringT const &file_name)
+inline void
+validate_identifier_name (StringT const &name, std::size_t line,
+ std::size_t column, StringT const &file_name)
{
using namespace std; // some systems have strtoul in namespace std::
-
+
typename StringT::size_type pos = name.find_first_of('\\');
while (StringT::npos != pos) {
// the identifier name contains a backslash (must be universal char)
BOOST_ASSERT('u' == name[pos+1] || 'U' == name[pos+1]);
-
+
StringT uchar_val(name.substr(pos+2, ('u' == name[pos+1]) ? 4 : 8));
- universal_char_type type =
- classify_universal_char(strtoul(uchar_val.c_str(), 0, 16));
-
+ universal_char_type type =
+ classify_universal_char(strtoul(uchar_val.c_str(), 0, 16));
+
if (universal_char_type_valid != type) {
// an invalid char was found, so throw an exception
StringT error_uchar(name.substr(pos, ('u' == name[pos+1]) ? 6 : 10));
-
+
if (universal_char_type_invalid == type) {
- BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_invalid,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_invalid,
error_uchar, line, column, file_name.c_str());
}
else if (universal_char_type_base_charset == type) {
- BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_base_charset,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_base_charset,
error_uchar, line, column, file_name.c_str());
}
else {
- BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_not_allowed,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_not_allowed,
error_uchar, line, column, file_name.c_str());
}
}
-
+
// find next universal char (if appropriate)
pos = name.find_first_of('\\', pos+2);
}
@@ -261,55 +261,55 @@
//
// validate_literal
//
-// The validate_literal function tests a given string or character literal
-// for its validity with regard to eventually contained universal
-// characters. These should be in valid ranges (see the function
+// The validate_literal function tests a given string or character literal
+// for its validity with regard to eventually contained universal
+// characters. These should be in valid ranges (see the function
// classify_universal_char above).
//
-// If the string or character literal contains invalid or not allowed
+// If the string or character literal contains invalid or not allowed
// universal characters a corresponding lexing_exception is thrown.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
-inline void
-validate_literal (StringT const &name, int line, int column,
+inline void
+validate_literal (StringT const &name, std::size_t line, std::size_t column,
StringT const &file_name)
{
using namespace std; // some systems have strtoul in namespace std::
-
+
typename StringT::size_type pos = name.find_first_of('\\');
while (StringT::npos != pos) {
// the literal contains a backslash (may be universal char)
if ('u' == name[pos+1] || 'U' == name[pos+1]) {
StringT uchar_val(name.substr(pos+2, ('u' == name[pos+1]) ? 4 : 8));
- universal_char_type type =
- classify_universal_char(strtoul(uchar_val.c_str(), 0, 16));
-
- if (universal_char_type_valid != type &&
- universal_char_type_not_allowed_for_identifiers != type)
+ universal_char_type type =
+ classify_universal_char(strtoul(uchar_val.c_str(), 0, 16));
+
+ if (universal_char_type_valid != type &&
+ universal_char_type_not_allowed_for_identifiers != type)
{
// an invalid char was found, so throw an exception
StringT error_uchar(name.substr(pos, ('u' == name[pos+1]) ? 6 : 10));
-
+
if (universal_char_type_invalid == type) {
- BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_invalid,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_invalid,
error_uchar, line, column, file_name.c_str());
}
else {
- BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_base_charset,
+ BOOST_WAVE_LEXER_THROW(lexing_exception, universal_char_base_charset,
error_uchar, line, column, file_name.c_str());
}
}
}
-
+
// find next universal char (if appropriate)
pos = name.find_first_of('\\', pos+2);
}
}
///////////////////////////////////////////////////////////////////////////////
-} // namespace impl
+} // namespace impl
} // namespace cpplexer
} // namespace wave
} // namespace boost
Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -34,6 +34,9 @@
sequence was skipped, now we skip only the macro itself, which still expands
the arguments for the macro invocation.
+Boost V1.52.0:
+ - Fixed a couple of compilation warnings
+
Boost V1.51.0
- Fixed #7050: Invalid memory write bug in lexing_exception
- Fixed #7159: Text-lines are processed as if they were preprocessing directives
Modified: trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -2,14 +2,14 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Copyright (c) 2001 Daniel C. Nuffer
- Copyright (c) 2001-2012 Hartmut Kaiser.
- Distributed under the Boost Software License, Version 1.0. (See accompanying
+ Copyright (c) 2001-2012 Hartmut Kaiser.
+ 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)
- TODO:
- It also may be necessary to add $ to identifiers, for asm.
+ TODO:
+ It also may be necessary to add $ to identifiers, for asm.
handle errors better.
- have some easier way to parse strings instead of files (done)
+ have some easier way to parse strings instead of files (done)
=============================================================================*/
#define BOOST_WAVE_SOURCE 1
@@ -31,7 +31,7 @@
#include <unistd.h>
#else
#include <io.h>
-#endif
+#endif
#include <boost/assert.hpp>
#include <boost/detail/workaround.hpp>
@@ -103,7 +103,7 @@
if (0 != s->act) {
RE2C_ASSERT(s->first != 0 && s->last != 0);
RE2C_ASSERT(s->first <= s->act && s->act <= s->last);
- if (s->act < s->last)
+ if (s->act < s->last)
return *(s->act)++;
}
return -1;
@@ -136,7 +136,7 @@
{
aq_queue q;
std::size_t i;
-
+
if (!s->eol_offsets)
s->eol_offsets = aq_create();
@@ -218,10 +218,10 @@
{
using namespace std; // some systems have printf in std
if (0 != s->error_proc) {
- (*s->error_proc)(s, lexing_exception::unexpected_error,
+ (*s->error_proc)(s, lexing_exception::unexpected_error,
"Out of memory!");
}
- else
+ else
printf("Out of memory!\n");
/* get the scanner to stop */
@@ -245,12 +245,12 @@
cnt = BOOST_WAVE_BSIZE;
memmove(s->lim, s->act, cnt);
s->act += cnt;
- if (cnt != BOOST_WAVE_BSIZE)
+ if (cnt != BOOST_WAVE_BSIZE)
{
s->eof = &s->lim[cnt]; *(s->eof)++ = '\0';
}
}
-
+
/* backslash-newline erasing time */
/* first scan for backslash-newline and erase them */
@@ -265,7 +265,7 @@
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
- aq_enqueue(s->eol_offsets, p - s->bot + 1);
+ aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
else if (*(p+len) == '\r')
{
@@ -283,14 +283,14 @@
cnt -= offset;
--p;
}
- aq_enqueue(s->eol_offsets, p - s->bot + 1);
+ aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
}
}
- /* FIXME: the following code should be fixed to recognize correctly the
+ /* FIXME: the following code should be fixed to recognize correctly the
trigraph backslash token */
-
+
/* check to see if what we just read ends in a backslash */
if (cnt >= 2)
{
@@ -304,7 +304,7 @@
if (next == '\n')
{
--cnt; /* chop the final \, we've already read the \n. */
- aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
+ aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
else if (next == '\r')
{
@@ -319,7 +319,7 @@
rewind_stream(s, -1);
--cnt;
}
- aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
+ aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
else if (next != -1) /* -1 means end of file */
{
@@ -341,13 +341,13 @@
rewind_stream(s, -1);
cnt -= 2;
}
- aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
+ aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
/* check \ \n EOB */
else if (last == '\n' && last2 == '\\')
{
cnt -= 2;
- aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
+ aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
}
@@ -362,21 +362,21 @@
}
///////////////////////////////////////////////////////////////////////////////
-// Special wrapper class holding the current cursor position
+// Special wrapper class holding the current cursor position
struct uchar_wrapper
{
- uchar_wrapper (uchar *base_cursor, unsigned int column = 1)
+ uchar_wrapper (uchar *base_cursor, std::size_t column = 1)
: base_cursor(base_cursor), column(column)
{}
- uchar_wrapper& operator++()
+ uchar_wrapper& operator++()
{
++base_cursor;
++column;
return *this;
}
- uchar_wrapper& operator--()
+ uchar_wrapper& operator--()
{
--base_cursor;
--column;
@@ -393,14 +393,14 @@
return base_cursor;
}
- friend std::ptrdiff_t
+ friend std::ptrdiff_t
operator- (uchar_wrapper const& lhs, uchar_wrapper const& rhs)
{
return lhs.base_cursor - rhs.base_cursor;
}
uchar *base_cursor;
- unsigned int column;
+ std::size_t column;
};
///////////////////////////////////////////////////////////////////////////////
@@ -428,7 +428,7 @@
} // namespace boost
#undef BOOST_WAVE_RET
-#undef BOOST_WAVE_BSIZE
+#undef BOOST_WAVE_BSIZE
#undef YYCTYPE
#undef YYCURSOR
#undef YYLIMIT
Modified: trunk/tools/wave/trace_macro_expansion.hpp
==============================================================================
--- trunk/tools/wave/trace_macro_expansion.hpp (original)
+++ trunk/tools/wave/trace_macro_expansion.hpp 2012-09-29 16:13:28 EDT (Sat, 29 Sep 2012)
@@ -76,8 +76,8 @@
pragma_mismatched_push_pop,
};
- bad_pragma_exception(char const *what_, error_code code, int line_,
- int column_, char const *filename_) throw()
+ bad_pragma_exception(char const *what_, error_code code, std::size_t line_,
+ std::size_t column_, char const *filename_) throw()
: boost::wave::preprocess_exception(what_,
(boost::wave::preprocess_exception::error_code)code, line_,
column_, filename_)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk