Skip to content

Commit fd900b2

Browse files
committed
Switch to C++20
1 parent 122b855 commit fd900b2

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
lines changed

SetCompilerFlags.cmake

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
2929
# set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs,--no-as-needed")
3030
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-z,defs,--no-as-needed,--no-undefined")
3131
include(CheckCXXCompilerFlag)
32-
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STDCPP0X)
33-
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STDCPP11)
34-
CHECK_CXX_COMPILER_FLAG(-std=c++14 HAVE_STDCPP14)
3532
CHECK_CXX_COMPILER_FLAG(-std=c++17 HAVE_STDCPP17)
3633
CHECK_CXX_COMPILER_FLAG(-std=c++20 HAVE_STDCPP20)
3734

@@ -46,16 +43,16 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
4643
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer")
4744
endif()
4845

49-
if (HAVE_STDCPP17)
50-
message("C++17 supported ")
51-
set(CMAKE_CXX_STANDARD 17)
52-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
53-
set(CMAKE_CXX_EXTENSIONS OFF)
54-
# if (HAVE_STDCPP20)
55-
# message("C++20 supported ")
56-
# set(CMAKE_CXX_STANDARD 20)
46+
# if (HAVE_STDCPP17)
47+
# message("C++17 supported ")
48+
# set(CMAKE_CXX_STANDARD 17)
5749
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
58-
# set(CMAKE_CXX_EXTENSIONS ON)
50+
# set(CMAKE_CXX_EXTENSIONS OFF)
51+
if (HAVE_STDCPP20)
52+
message("C++20 supported ")
53+
set(CMAKE_CXX_STANDARD 20)
54+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55+
set(CMAKE_CXX_EXTENSIONS ON)
5956
else ()
6057
message(FATAL_ERROR "Minimum C++ version NOT supported")
6158
endif ()
@@ -138,9 +135,6 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
138135
# set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-as-needed")
139136

140137
include(CheckCXXCompilerFlag)
141-
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STDCPP0X)
142-
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STDCPP11)
143-
CHECK_CXX_COMPILER_FLAG(-std=c++14 HAVE_STDCPP14)
144138
CHECK_CXX_COMPILER_FLAG(-std=c++17 HAVE_STDCPP17)
145139
CHECK_CXX_COMPILER_FLAG(-std=c++20 HAVE_STDCPP20)
146140
CHECK_CXX_COMPILER_FLAG(-fno-omit-frame-pointer HAVE_NO_OMIT_FRAME_POINTER)

deeplima/libs/static_graph/dict_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ template <class D=std::shared_ptr<DictBase>>
2525
class DictsHolderImpl : public std::vector<D>
2626
{
2727
public:
28-
virtual ~DictsHolderImpl<D>() = default;
28+
virtual ~DictsHolderImpl() = default;
2929
std::vector<uint32_t> get_counters() const
3030
{
3131
std::vector<uint32_t> v(this->size());

lima_common/src/common/FsaAccess/FsaAccessBuilderRandom16.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,6 @@ bool FsaAccessBuilderRandom16::scanAndCloneConfluentStates(
347347
graphType::degree_size_type ind = boost::in_degree(to, m_graph);
348348
if( ind > 1 ) {
349349
// c'est un etat confluent: suppressEdge( from, to, currentChar );
350-
#ifdef DEBUG_CD
351-
std::ostringstream oss;
352-
oss << "FsaAccessBuilderRandom16::scanAndCloneConfluentStates: supressEdge("
353-
<< edge << "," << currentChar << ")";
354-
LDEBUG << oss.str().c_str();
355-
#endif
356350
// remove element from vector counts
357351
// tableau des coefficients
358352
graphType::degree_size_type outd0 = boost::out_degree(from, m_graph);

lima_linguisticprocessing/src/linguisticProcessing/core/Compounds/CompoundsBuilderFromSyntacticData.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,22 @@ void CompoundsBuilderFromSyntacticDataPrivate::initMacros2ConceptsMapping(
199199
{
200200
LinguisticCode macro = macroManager.getPropertyValue((*it).first);
201201
std::string typeName = (*it).second;
202-
Lima::Common::MediaticData::ConceptType concept = (*(m_conceptTypes.find("LatticeDown"))).second;
202+
Lima::Common::MediaticData::ConceptType semanticConcept = (*(m_conceptTypes.find("LatticeDown"))).second;
203203
if (m_conceptTypes.find(typeName) == m_conceptTypes.end())
204204
{
205205
MDATALOGINIT;
206206
LERROR << "Concept type name " << typeName.c_str() << " not found. Keeping LatticeDown (should be '0').";
207207
}
208208
else
209209
{
210-
concept = (*(m_conceptTypes.find(typeName))).second;
210+
semanticConcept = (*(m_conceptTypes.find(typeName))).second;
211211
}
212212

213213
#ifdef DEBUG_LP
214214
LDEBUG << " " << (*it).first << " (" << macro << ") <-> "
215-
<< (*it).second << " (" << concept << ")";
215+
<< (*it).second << " (" << semanticConcept << ")";
216216
#endif
217-
m_macro2ConceptMapping.insert(std::make_pair(macro,concept));
217+
m_macro2ConceptMapping.insert(std::make_pair(macro, semanticConcept));
218218
}
219219

220220
}

lima_linguisticprocessing/tools/automatonCompiler/libautomatonCompiler/recognizerCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ readSubAutomaton(const LimaString& line,
450450
if (bracket==-1) {
451451
ostringstream oss;
452452
oss << "definition of sub-automaton must have opening character "
453-
<<CHAR_SUBAUTOMATON_BEGIN.unicode()<<" on first line";
453+
<< int(CHAR_SUBAUTOMATON_BEGIN.unicode()) << " on first line";
454454
throwError(oss.str(),line);
455455
}
456456
sub.setAutomatonName(line.left(bracket).trimmed());

lima_linguisticprocessing/tools/common/readBoWFile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ void readSDocuments(ifstream& fileIn, BoWDocument* document, BoWBinaryReader& re
273273
cout << writer << endl;
274274
break;
275275
}
276+
default:
277+
{
278+
std::string err_msg = "Unsupported BoWBlocType.";
279+
std::cerr << "Error: " << err_msg << std::endl;
280+
throw LimaException(err_msg);
281+
}
276282
}
277283
if (bt!=BagOfWords::BoWBlocType::END_BLOC)
278284
{

0 commit comments

Comments
 (0)