Skip to content

Commit

Permalink
Merge pull request apache#6440 from bitrunner/cnd-update-language-sta…
Browse files Browse the repository at this point in the history
…ndards

[cnd] add C17, C23, C++20, C++23 language standards
  • Loading branch information
vieiro authored Oct 2, 2023
2 parents 6b5a36b + da26e29 commit a3e5b5a
Show file tree
Hide file tree
Showing 20 changed files with 614 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public enum LanguageFlavor {
CPP98(4), CPP11(8),
F77(5), F90(6), F95(7),
DEFAULT(9),
C11(10), CPP14(11), CPP17(12);
C11(10), CPP14(11), CPP17(12),
C17(13), C23(14),
CPP20(15), CPP23(16);
private final int flavor;

private LanguageFlavor(int flavor) {
Expand All @@ -58,6 +60,10 @@ public static LanguageFlavor fromExternal(int i) {
case 10: return C11;
case 11: return CPP14;
case 12: return CPP17;
case 13: return C17;
case 14: return C23;
case 15: return CPP20;
case 16: return CPP23;
default: return UNKNOWN;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public static NativeFileItem.LanguageFlavor cndStandardToItemFlavor(CndLanguageS
case C11:
flavor =NativeFileItem.LanguageFlavor.C11;
break;
case C17:
flavor =NativeFileItem.LanguageFlavor.C17;
break;
case C23:
flavor =NativeFileItem.LanguageFlavor.C23;
break;
case CPP98:
flavor =NativeFileItem.LanguageFlavor.CPP98;
break;
Expand All @@ -125,6 +131,12 @@ public static NativeFileItem.LanguageFlavor cndStandardToItemFlavor(CndLanguageS
case CPP17:
flavor =NativeFileItem.LanguageFlavor.CPP17;
break;
case CPP20:
flavor =NativeFileItem.LanguageFlavor.CPP20;
break;
case CPP23:
flavor =NativeFileItem.LanguageFlavor.CPP23;
break;
}
return flavor;
}
Expand All @@ -144,6 +156,10 @@ public static CndLanguageStandard itemFlavorToCndStandard(NativeFileItem.Languag
return CndLanguageStandard.C99;
case C11:
return CndLanguageStandard.C11;
case C17:
return CndLanguageStandard.C17;
case C23:
return CndLanguageStandard.C23;
case CPP98:
return CndLanguageStandard.CPP98;
case CPP11:
Expand All @@ -152,6 +168,10 @@ public static CndLanguageStandard itemFlavorToCndStandard(NativeFileItem.Languag
return CndLanguageStandard.CPP14;
case CPP17:
return CndLanguageStandard.CPP17;
case CPP20:
return CndLanguageStandard.CPP20;
case CPP23:
return CndLanguageStandard.CPP23;
case F77:
case F90:
case F95:
Expand Down Expand Up @@ -195,14 +215,12 @@ public static NativeFileItem.LanguageFlavor getDefaultCppStandard() {
CndLanguageStandards.CndLanguageStandard defaultStandard = me.getDefaultStandard();
if (defaultStandard != null) {
switch(defaultStandard) {
case CPP11:
return NativeFileItem.LanguageFlavor.CPP11;
case CPP14:
return NativeFileItem.LanguageFlavor.CPP14;
case CPP17:
return NativeFileItem.LanguageFlavor.CPP17;
case CPP98:
return NativeFileItem.LanguageFlavor.CPP98;
case CPP98: return NativeFileItem.LanguageFlavor.CPP98;
case CPP11: return NativeFileItem.LanguageFlavor.CPP11;
case CPP14: return NativeFileItem.LanguageFlavor.CPP14;
case CPP17: return NativeFileItem.LanguageFlavor.CPP17;
case CPP20: return NativeFileItem.LanguageFlavor.CPP20;
case CPP23: return NativeFileItem.LanguageFlavor.CPP23;
}
}
return NativeFileItem.LanguageFlavor.UNKNOWN;
Expand All @@ -219,14 +237,12 @@ public static NativeFileItem.LanguageFlavor getDefaultHeaderStandard() {
CndLanguageStandards.CndLanguageStandard defaultStandard = me.getDefaultStandard();
if (defaultStandard != null) {
switch(defaultStandard) {
case CPP11:
return NativeFileItem.LanguageFlavor.CPP11;
case CPP14:
return NativeFileItem.LanguageFlavor.CPP14;
case CPP17:
return NativeFileItem.LanguageFlavor.CPP17;
case CPP98:
return NativeFileItem.LanguageFlavor.CPP98;
case CPP98: return NativeFileItem.LanguageFlavor.CPP98;
case CPP11: return NativeFileItem.LanguageFlavor.CPP11;
case CPP14: return NativeFileItem.LanguageFlavor.CPP14;
case CPP17: return NativeFileItem.LanguageFlavor.CPP17;
case CPP20: return NativeFileItem.LanguageFlavor.CPP20;
case CPP23: return NativeFileItem.LanguageFlavor.CPP23;
}
}
return NativeFileItem.LanguageFlavor.UNKNOWN;
Expand All @@ -243,12 +259,11 @@ public static NativeFileItem.LanguageFlavor getDefaultCStandard() {
CndLanguageStandards.CndLanguageStandard defaultStandard = me.getDefaultStandard();
if (defaultStandard != null) {
switch(defaultStandard) {
case C89:
return NativeFileItem.LanguageFlavor.C89;
case C99:
return NativeFileItem.LanguageFlavor.C99;
case C11:
return NativeFileItem.LanguageFlavor.C11;
case C89: return NativeFileItem.LanguageFlavor.C89;
case C99: return NativeFileItem.LanguageFlavor.C99;
case C11: return NativeFileItem.LanguageFlavor.C11;
case C17: return NativeFileItem.LanguageFlavor.C17;
case C23: return NativeFileItem.LanguageFlavor.C23;
}
}
return NativeFileItem.LanguageFlavor.UNKNOWN;
Expand Down
Loading

0 comments on commit a3e5b5a

Please sign in to comment.