Skip to content

Commit 31b4b27

Browse files
committed
{cs,gcc-}parser: eliminate warning[-Wodr] reports with -flto
Error: COMPILER_WARNING: csparser.cc:87:6: warning[-Wodr]: type 'EToken' violates the C++ One Definition Rule gcc-parser.cc:27:6: note: an enum with different value name is defined in another translation unit csparser.cc:89:5: note: name 'T_EMPTY' differs from name 'T_UNKNOWN' defined in another translation unit gcc-parser.cc:29:5: note: mismatching definition
1 parent 456931b commit 31b4b27

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/csparser.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include <boost/algorithm/string.hpp>
3333

34+
namespace CovParserImpl {
35+
3436
class LineReader {
3537
public:
3638
LineReader(std::istream &input):
@@ -196,6 +198,10 @@ EToken ErrFileLexer::readNext()
196198
return T_EVENT;
197199
}
198200

201+
} // namespace CovParserImpl
202+
203+
using namespace CovParserImpl;
204+
199205
struct KeyEventDigger::Private {
200206
typedef std::set<std::string> TSet;
201207
typedef std::map<std::string, TSet> TMap;

src/gcc-parser.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include <algorithm>
2626

27+
namespace GccParserImpl {
28+
2729
enum EToken {
2830
T_NULL = 0,
2931
T_UNKNOWN,
@@ -554,6 +556,10 @@ bool BasicGccParser::hasError() const
554556
return hasError_;
555557
}
556558

559+
} // namespace GccParserImpl
560+
561+
using namespace GccParserImpl;
562+
557563
struct GccPostProcessor::Private {
558564
const LangDetector langDetector;
559565

0 commit comments

Comments
 (0)