On Mon, 2023-09-11 at 19:44 +0200, priour...@gmail.com wrote: > From: benjamin priour <vultk...@gcc.gnu.org> > > Hi, > > Patch below is mostly done, just have to check the formatting. > Althought, I'd like your feedback on how to manage named_constants > from enum in C++. > > I've checked and the analyzer works as expected with them. > However, C++ FE makes it so that given > > enum > { > NAMED = 0x1 > }; > > then in analyzer-language.cc:maybe_stash_named_constant > > tree t = tu.lookup_constant_by_id (id); > ... > logger->log ("%qs: %qE", name, t); > > t is printed as 1 in C, but NAMED in C++. > Should it be left as a "FE specifity", > or should we aim for 1 in C++ as well ?
Thanks for the patch. It seems that the patch consists of three parts: (a) adding kf_bzero (b) refactoring/moving c_translation_unit so it can be used by g++ (c) a whole bunch of tests being moved, some of which may depend on (a) and (b); are there some that don't? Given how big the (c) changes look like in a "diff", I'd prefer the (a) and (b) changes to be split out as preliminaries, for readability. Presumably this change could be made part of (a): * gcc.dg/analyzer/bzero-1.c: Moved to... * c-c++-common/analyzer/bzero-1.c: ...here. Does anything in the patch actually use (b)? IIRC it's used by the file-descriptor tests, so fd-*.c, pipe-*.c, etc. As for your question, lookup_constant_by_id should return an INTEGER_CST (or NULL_TREE), so presumably we want t to be printed as '1' with both frontends. Dave