Skip to content

Commit e8c35aa

Browse files
committed
hooked up simplecpp::C23 [skip ci]
1 parent 2578f94 commit e8c35aa

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

gui/mainwindow.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
295295
mUI->mActionC11->setActionGroup(mCStandardActions);
296296
//mUI->mActionC17->setActionGroup(mCStandardActions);
297297
//mUI->mActionC23->setActionGroup(mCStandardActions);
298+
//mUI->mActionC2Y->setActionGroup(mCStandardActions);
298299

299300
mUI->mActionCpp03->setActionGroup(mCppStandardActions);
300301
mUI->mActionCpp11->setActionGroup(mCppStandardActions);
@@ -421,6 +422,7 @@ void MainWindow::loadSettings()
421422
mUI->mActionC11->setChecked(standards.c == Standards::C11);
422423
//mUI->mActionC17->setChecked(standards.c == Standards::C17);
423424
//mUI->mActionC23->setChecked(standards.c == Standards::C23);
425+
//mUI->mActionC2Y->setChecked(standards.c == Standards::C2Y);
424426
standards.setCPP(mSettings->value(SETTINGS_STD_CPP, QString()).toString().toStdString());
425427
mUI->mActionCpp03->setChecked(standards.cpp == Standards::CPP03);
426428
mUI->mActionCpp11->setChecked(standards.cpp == Standards::CPP11);
@@ -522,6 +524,8 @@ void MainWindow::saveSettings() const
522524
// mSettings->setValue(SETTINGS_STD_C, "C17");
523525
//if (mUI->mActionC23->isChecked())
524526
// mSettings->setValue(SETTINGS_STD_C, "C23");
527+
//if (mUI->mActionC2Y->isChecked())
528+
// mSettings->setValue(SETTINGS_STD_C, "C2Y");
525529

526530
if (mUI->mActionCpp03->isChecked())
527531
mSettings->setValue(SETTINGS_STD_CPP, "C++03");

gui/mainwindow.ui

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
<addaction name="mActionC11"/>
230230
<!--addaction name="mActionC17"/-->
231231
<!--addaction name="mActionC23"/-->
232+
<!--addaction name="mActionC2Y"/-->
232233
</widget>
233234
<addaction name="mActionAnalyzeFiles"/>
234235
<addaction name="mActionAnalyzeDirectory"/>
@@ -828,6 +829,14 @@
828829
<string>C&amp;23</string>
829830
</property>
830831
</action-->
832+
<!--action name="mActionC2Y">
833+
<property name="checkable">
834+
<bool>true</bool>
835+
</property>
836+
<property name="text">
837+
<string>C&amp;2y</string>
838+
</property>
839+
</action-->
831840
<action name="mActionC89">
832841
<property name="checkable">
833842
<bool>true</bool>

lib/keywords.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ static const std::unordered_set<std::string> c23_keywords = {
7777
C23_KEYWORDS
7878
};
7979

80+
static const std::unordered_set<std::string> c2y_keywords_all = {
81+
C90_KEYWORDS, C99_KEYWORDS, C11_KEYWORDS, C23_KEYWORDS
82+
};
83+
84+
static const std::unordered_set<std::string> c2y_keywords = {
85+
C23_KEYWORDS
86+
};
87+
8088
// see https://en.cppreference.com/w/cpp/keyword
8189

8290
#define CPP03_KEYWORDS \
@@ -181,6 +189,8 @@ const std::unordered_set<std::string>& Keywords::getAll(Standards::cstd_t cStd)
181189
return c17_keywords_all;
182190
case Standards::cstd_t::C23:
183191
return c23_keywords_all;
192+
case Standards::cstd_t::C2Y:
193+
return c2y_keywords_all;
184194
}
185195
cppcheck::unreachable();
186196
}
@@ -222,6 +232,8 @@ const std::unordered_set<std::string>& Keywords::getOnly(Standards::cstd_t cStd)
222232
return c17_keywords;
223233
case Standards::cstd_t::C23:
224234
return c23_keywords;
235+
case Standards::cstd_t::C2Y:
236+
return c2y_keywords;
225237
}
226238
cppcheck::unreachable();
227239
}

lib/standards.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ static Standards::cstd_t mapC(simplecpp::cstd_t cstd) {
3636
return Standards::C17;
3737
case simplecpp::C23:
3838
return Standards::C23;
39+
case simplecpp::C2Y:
40+
return Standards::C2Y;
3941
case simplecpp::CUnknown:
4042
return Standards::CLatest;
4143
}
@@ -73,6 +75,8 @@ std::string Standards::getC(cstd_t c_std)
7375
return "c17";
7476
case C23:
7577
return "c23";
78+
case C2Y:
79+
return "c2y";
7680
}
7781
return "";
7882
}

lib/standards.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct CPPCHECKLIB Standards {
3838
enum Language : std::uint8_t { None, C, CPP };
3939

4040
/** C code standard */
41-
enum cstd_t : std::uint8_t { C89, C99, C11, C17, C23, CLatest = C23 } c = CLatest;
41+
enum cstd_t : std::uint8_t { C89, C99, C11, C17, C23, C2Y, CLatest = C2Y } c = CLatest;
4242

4343
/** C++ code standard */
4444
enum cppstd_t : std::uint8_t { CPP03, CPP11, CPP14, CPP17, CPP20, CPP23, CPP26, CPPLatest = CPP26 } cpp = CPPLatest;

0 commit comments

Comments
 (0)