Fix compile error in clang-16; large number of constexpr string_view causes compile error.

This commit is contained in:
Stephen Anthony 2022-12-30 21:17:02 -03:30
parent 498af52ca2
commit 8ded49c33a
2 changed files with 18 additions and 2 deletions

View File

@ -27,7 +27,14 @@
static constexpr uInt32 DEF_PROPS_SIZE = 3637;
static constexpr BSPF::array2D<string_view, DEF_PROPS_SIZE, 29> DefProps = {{
/**
FIXME
We need to use 'const char*' instead of 'string_view' here,
since clang is not optimized to create so many constexpr
'string_view's. It *can* do it by using
-fconstexpr-steps=2710000, which increases binary size.
*/
static constexpr BSPF::array2D<const char*, DEF_PROPS_SIZE, 29> DefProps = {{
{ "000509d1ed2b8d30a9d94be1b3b5febb", "Greg Zumwalt", "", "Jungle Jane (2003) (Greg Zumwalt) (Hack)", "Hack of Pitfall!", "Hack", "", "", "", "{\"score_addresses\":[\"0xd5\",\"0xd6\",\"0xd7\"],\"score_digits\":6,\"variations_count\":1}", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "0060a89b4c956b9c703a59b181cb3018", "CommaVid, Irwin Gaines - Ariola", "CM-008 - 712 008-720", "Cakewalk (1983) (CommaVid) (PAL)", "AKA Alarm in der Backstube", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "007d18dedc1f0565f09c42aa61a6f585", "CCE", "C-843", "Worm War I (1983) (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -68,7 +68,16 @@ print OUTFILE " regenerated and the application recompiled.\n";
print OUTFILE "*/\n";
print OUTFILE "\nstatic constexpr uInt32 DEF_PROPS_SIZE = " . $setsize . ";";
print OUTFILE "\n\n";
print OUTFILE "static constexpr BSPF::array2D<string_view, DEF_PROPS_SIZE, " . $typesize . "> DefProps = {{\n";
print OUTFILE "/**\n";
# FIXME: Remove this once clang properly supports constexpr string_view
print OUTFILE " FIXME\n";
print OUTFILE " We need to use 'const char*' instead of 'string_view' here,\n";
print OUTFILE " since clang is not optimized to create so many constexpr\n";
print OUTFILE " 'string_view's. It *can* do it by using\n";
print OUTFILE " -fconstexpr-steps=2710000, which increases binary size.\n";
print OUTFILE "*/\n";
#######################################################################
print OUTFILE "static constexpr BSPF::array2D<const char*, DEF_PROPS_SIZE, " . $typesize . "> DefProps = {{\n";
# Walk the hash map and print each item in order of md5sum
my $idx = 0;