> -----Original Message----- > From: Philippe Mathieu-Daudé <philippe.mathieu.da...@gmail.com> On > Behalf Of Philippe Mathieu-Daudé > Sent: Monday, January 25, 2021 10:21 AM > To: Taylor Simpson <tsimp...@quicinc.com>; qemu-devel@nongnu.org; > Paolo Bonzini <pbonz...@redhat.com> > Cc: a...@rev.ng; alex.ben...@linaro.org; richard.hender...@linaro.org; > laur...@vivier.eu; Brian Cain <bc...@quicinc.com> > Subject: Re: [PATCH v7 12/35] Hexagon (target/hexagon) instruction > attributes > > >> On 1/20/21 4:28 AM, Taylor Simpson wrote: > >>> Signed-off-by: Taylor Simpson <tsimp...@quicinc.com> > >>> --- > >>> target/hexagon/attribs.h | 30 ++++++++++++++ > >>> target/hexagon/attribs_def.h | 95 > >> ++++++++++++++++++++++++++++++++++++++++++++ > >>> 2 files changed, 125 insertions(+) > >>> create mode 100644 target/hexagon/attribs.h > >>> create mode 100644 target/hexagon/attribs_def.h > >>> > >>> diff --git a/target/hexagon/attribs.h b/target/hexagon/attribs.h > >>> new file mode 100644 > >>> index 0000000..e88e5eb > >>> --- /dev/null > >>> +++ b/target/hexagon/attribs.h > >>> @@ -0,0 +1,30 @@ > >>> + > >>> +enum { > >>> +#define DEF_ATTRIB(NAME, ...) A_##NAME, > >>> +#include "attribs_def.h" > >> > >> Per QEMU conventions, this file has to be named "attribs_def.h.inc". > > > > Didn't know that. Which files should end in .inc? > > Oh you are right, it is not documented in CODING_STYLE.rst. > > You can see the rationale in commits:139c1837db7 and 0979ed017f0: > > meson: rename included C source files to .c.inc > > With Makefiles that have automatically generated dependencies, you > generated includes are set as dependencies of the Makefile, so that they > are built before everything else and they are available when first > building the .c files. > > Alternatively you can use a fine-grained dependency, e.g. > > target/arm/translate.o: target/arm/decode-neon-shared.inc.c > > With Meson you have only one choice and it is a third option, namely > "build at the beginning of the corresponding target"; the way you > express it is to list the includes in the sources of that target. > > The problem is that Meson decides if something is a source vs. a > generated include by looking at the extension: '.c', '.cc', '.m', '.C' > are sources, while everything else is considered an include---including > '.inc.c'. > > Use '.c.inc' to avoid this, as it is consistent with our other convention > of using '.rst.inc' for included reStructuredText files. The editorconfig > file is adjusted.
OK, I understand why it's better to have files end .[ch].inc than .inc.[ch]. However, I need some confirmation on which files need .inc instead of simply ending in .h. From what I can tell these are the guidelines - If a file is intended to be included in the middle of another file (as opposed to the top), it should end in .inc. - If a .inc file is intended to be included in a .h file, it should end in .h.inc. - If a .inc file is intended to be included in a .c file, it should end in .c.inc. - The above applies to both human-written and generated files. Thanks, Taylor