[PATCH] D73044: {tablegen] Emit string literals instead of char arrays

Luke Drummond via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 04:08:03 PST 2020


ldrumm marked an inline comment as done.
ldrumm added inline comments.


================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:652
+  # known to support them (everything but MSVC)
+  add_flag_if_supported("-Wno-overlength-strings" IGNORE_OVERLENGTH_STRINGS)
+
----------------
rnk wrote:
> Instead of this, I would suggest doing this in the generated source:
> ```
> #ifdef __GNUC
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Woverlength-strings"
> #endif
> ...
> #ifdef __GNUC
> #pragma GCC diagnostic pop
> #endif
> ```
> That way, we still benefit from this warning in places where we aren't explicitly taking steps to avoid the problem.
While limiting the surface of the warning might be nice, I'm not convinced by the value proposition of adding code to emit this in every tablegen backend.
I could add  `emit_boilerplate_macros_prologue/epilogue()` functions to `SequenceToTableOffset` that are called at the beginning and end of every tablegen backend, but again I don't think it's worth the extra complexity vs silencing a basically pointless warning on a compiler that has never had this limitatation


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73044/new/

https://reviews.llvm.org/D73044





More information about the llvm-commits mailing list