From 6e1bc4c77c634888889e0a3671b66b7ef87daca2 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Fri, 30 Dec 2022 21:17:02 -0330 Subject: [PATCH] Fix compile error in clang-16; large number of constexpr string_view causes compile error. --- src/emucore/DefProps.hxx | 9 ++++++++- src/tools/create_props.pl | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/emucore/DefProps.hxx b/src/emucore/DefProps.hxx index f9e0e724f..e31cb74f6 100644 --- a/src/emucore/DefProps.hxx +++ b/src/emucore/DefProps.hxx @@ -27,7 +27,14 @@ static constexpr uInt32 DEF_PROPS_SIZE = 3637; -static constexpr BSPF::array2D 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 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)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, diff --git a/src/tools/create_props.pl b/src/tools/create_props.pl index 44ae7f631..733e4367e 100755 --- a/src/tools/create_props.pl +++ b/src/tools/create_props.pl @@ -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 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 DefProps = {{\n"; # Walk the hash map and print each item in order of md5sum my $idx = 0;