Message ID | 1453832250-766-16-git-send-email-peter.maydell@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 01/27/2016 05:17 AM, Peter Maydell wrote: > diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c > index 0ed10a9..8467d5d 100644 > --- a/tcg/aarch64/tcg-target.c > +++ b/tcg/aarch64/tcg-target.c > @@ -10,6 +10,7 @@ > * See the COPYING file in the top-level directory for details. > */ > > +#include "qemu/osdep.h" > #include "tcg-be-ldst.h" > #include "qemu/bitops.h" > > diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c > index 3edf6a6..146ac00 100644 > --- a/tcg/arm/tcg-target.c > +++ b/tcg/arm/tcg-target.c > @@ -22,6 +22,7 @@ > * THE SOFTWARE. > */ > > +#include "qemu/osdep.h" > #include "elf.h" > #include "tcg-be-ldst.h" > > diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c > index 9187d34..d90636c 100644 > --- a/tcg/i386/tcg-target.c > +++ b/tcg/i386/tcg-target.c > @@ -22,6 +22,7 @@ > * THE SOFTWARE. > */ > > +#include "qemu/osdep.h" > #include "tcg-be-ldst.h" > > #ifndef NDEBUG Nack to these, and the others like them. These files are not standalone, they are included into tcg.c, so we ought not be re-including qemu/osdep.h here. > diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c > index 79e052f..2dc4998 100644 > --- a/tcg/mips/tcg-target.c > +++ b/tcg/mips/tcg-target.c > @@ -1735,7 +1736,6 @@ static int tcg_target_callee_save_regs[] = { > /* The Linux kernel doesn't provide any information about the available > instruction set. Probe it using a signal handler. */ > > -#include <signal.h> > > #ifndef use_movnz_instructions > bool use_movnz_instructions = false; But this is good. > diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c > index 2c72565..c593344 100644 > --- a/tcg/ppc/tcg-target.c > +++ b/tcg/ppc/tcg-target.c > @@ -2725,8 +2726,6 @@ static void __attribute__((constructor)) tcg_cache_init(void) > } > > #elif defined __APPLE__ > -#include <stdio.h> > -#include <sys/types.h> > #include <sys/sysctl.h> > > static void __attribute__((constructor)) tcg_cache_init(void) > @@ -2745,11 +2744,6 @@ static void __attribute__((constructor)) tcg_cache_init(void) > } > > #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > -#include <errno.h> > -#include <stdio.h> > -#include <stdlib.h> > -#include <string.h> > -#include <sys/types.h> > #include <sys/sysctl.h> > > static void __attribute__((constructor)) tcg_cache_init(void) And this. r~
On 6 February 2016 at 00:51, Richard Henderson <rth@twiddle.net> wrote: > On 01/27/2016 05:17 AM, Peter Maydell wrote: >> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c >> index 9187d34..d90636c 100644 >> --- a/tcg/i386/tcg-target.c >> +++ b/tcg/i386/tcg-target.c >> @@ -22,6 +22,7 @@ >> * THE SOFTWARE. >> */ >> >> +#include "qemu/osdep.h" >> #include "tcg-be-ldst.h" >> >> #ifndef NDEBUG > > > Nack to these, and the others like them. > These files are not standalone, they are > included into tcg.c, so we ought not be > re-including qemu/osdep.h here. Mmm, but I preferred to retain the invariant that "all .c files include osdep.h first" rather than special casing these; the re-include is harmless. Alternatively we could rename these tcg-target.c files to some other extension that makes it clearer that they're not standalone source files. (This is commit 757e725b58c57 in master now, so I'll write a patch that fixes things up.) thanks -- PMM
On Feb 7, 2016 00:43, Peter Maydell <peter.maydell@linaro.org> wrote: > Alternatively we could rename these tcg-target.c > files to some other extension that makes it clearer that > they're not standalone source files. Maybe for next cycle I can get around my goal of changing this around to be more md-file-like. Which would allow more compile-time validation, instead of the collection of start-time asserts (which don't even run without --enable-debug-tcg). r~
On 6 February 2016 at 13:43, Peter Maydell <peter.maydell@linaro.org> wrote: > On 6 February 2016 at 00:51, Richard Henderson <rth@twiddle.net> wrote: >> On 01/27/2016 05:17 AM, Peter Maydell wrote: >>> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c >>> index 9187d34..d90636c 100644 >>> --- a/tcg/i386/tcg-target.c >>> +++ b/tcg/i386/tcg-target.c >>> @@ -22,6 +22,7 @@ >>> * THE SOFTWARE. >>> */ >>> >>> +#include "qemu/osdep.h" >>> #include "tcg-be-ldst.h" >>> >>> #ifndef NDEBUG >> >> >> Nack to these, and the others like them. >> These files are not standalone, they are >> included into tcg.c, so we ought not be >> re-including qemu/osdep.h here. > > Mmm, but I preferred to retain the invariant that "all .c > files include osdep.h first" rather than special casing > these; the re-include is harmless. > > Alternatively we could rename these tcg-target.c > files to some other extension that makes it clearer that > they're not standalone source files. How do you feel about renaming the tcg-target.c files to tcg-target.inc.c ? Then I can make clean-includes know that *.inc.c are not to have the cleaning rules applied to them. thanks -- PMM
On 02/19/2016 10:24 AM, Peter Maydell wrote: > On 6 February 2016 at 13:43, Peter Maydell <peter.maydell@linaro.org> wrote: >> On 6 February 2016 at 00:51, Richard Henderson <rth@twiddle.net> wrote: >>> On 01/27/2016 05:17 AM, Peter Maydell wrote: >>>> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c >>>> index 9187d34..d90636c 100644 >>>> --- a/tcg/i386/tcg-target.c >>>> +++ b/tcg/i386/tcg-target.c >>>> @@ -22,6 +22,7 @@ >>>> * THE SOFTWARE. >>>> */ >>>> >>>> +#include "qemu/osdep.h" >>>> #include "tcg-be-ldst.h" >>>> >>>> #ifndef NDEBUG >>> >>> >>> Nack to these, and the others like them. >>> These files are not standalone, they are >>> included into tcg.c, so we ought not be >>> re-including qemu/osdep.h here. >> >> Mmm, but I preferred to retain the invariant that "all .c >> files include osdep.h first" rather than special casing >> these; the re-include is harmless. >> >> Alternatively we could rename these tcg-target.c >> files to some other extension that makes it clearer that >> they're not standalone source files. > > How do you feel about renaming the tcg-target.c files to > tcg-target.inc.c ? Then I can make clean-includes know that > *.inc.c are not to have the cleaning rules applied to them. I suppose. Though is the pattern "*.inc.c" really any better than "tcg-target.c"? r~
On 22 February 2016 at 19:11, Richard Henderson <rth@twiddle.net> wrote: > On 02/19/2016 10:24 AM, Peter Maydell wrote: >> How do you feel about renaming the tcg-target.c files to >> tcg-target.inc.c ? Then I can make clean-includes know that >> *.inc.c are not to have the cleaning rules applied to them. > > I suppose. Though is the pattern "*.inc.c" really any better > than "tcg-target.c"? I think it's kind of confusing that tcg-target.c isn't a standalone C file, so giving it a clearer name is nicer for humans too. -- PMM
On 02/22/2016 11:24 AM, Peter Maydell wrote: > On 22 February 2016 at 19:11, Richard Henderson <rth@twiddle.net> wrote: >> On 02/19/2016 10:24 AM, Peter Maydell wrote: >>> How do you feel about renaming the tcg-target.c files to >>> tcg-target.inc.c ? Then I can make clean-includes know that >>> *.inc.c are not to have the cleaning rules applied to them. >> >> I suppose. Though is the pattern "*.inc.c" really any better >> than "tcg-target.c"? > > I think it's kind of confusing that tcg-target.c isn't a > standalone C file, so giving it a clearer name is nicer > for humans too. No objection then. r~
diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c index 0ed10a9..8467d5d 100644 --- a/tcg/aarch64/tcg-target.c +++ b/tcg/aarch64/tcg-target.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory for details. */ +#include "qemu/osdep.h" #include "tcg-be-ldst.h" #include "qemu/bitops.h" diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index 3edf6a6..146ac00 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "elf.h" #include "tcg-be-ldst.h" diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 9187d34..d90636c 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-ldst.h" #ifndef NDEBUG diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c index 79e052f..2dc4998 100644 --- a/tcg/mips/tcg-target.c +++ b/tcg/mips/tcg-target.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-ldst.h" #ifdef HOST_WORDS_BIGENDIAN @@ -1735,7 +1736,6 @@ static int tcg_target_callee_save_regs[] = { /* The Linux kernel doesn't provide any information about the available instruction set. Probe it using a signal handler. */ -#include <signal.h> #ifndef use_movnz_instructions bool use_movnz_instructions = false; diff --git a/tcg/optimize.c b/tcg/optimize.c index 10795ec..6d68f57 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -23,10 +23,8 @@ * THE SOFTWARE. */ -#include "config.h" +#include "qemu/osdep.h" -#include <stdlib.h> -#include <stdio.h> #include "qemu-common.h" #include "tcg-op.h" diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c index 2c72565..c593344 100644 --- a/tcg/ppc/tcg-target.c +++ b/tcg/ppc/tcg-target.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-ldst.h" #if defined _CALL_DARWIN || defined __APPLE__ @@ -2725,8 +2726,6 @@ static void __attribute__((constructor)) tcg_cache_init(void) } #elif defined __APPLE__ -#include <stdio.h> -#include <sys/types.h> #include <sys/sysctl.h> static void __attribute__((constructor)) tcg_cache_init(void) @@ -2745,11 +2744,6 @@ static void __attribute__((constructor)) tcg_cache_init(void) } #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> #include <sys/sysctl.h> static void __attribute__((constructor)) tcg_cache_init(void) diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c index fbf97bb..58520fa 100644 --- a/tcg/s390/tcg-target.c +++ b/tcg/s390/tcg-target.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-ldst.h" /* We only support generating code for 64-bit mode. */ diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c index 54df1bc..d3100ab 100644 --- a/tcg/sparc/tcg-target.c +++ b/tcg/sparc/tcg-target.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-null.h" #ifndef NDEBUG diff --git a/tcg/tcg-common.c b/tcg/tcg-common.c index 8fa4e13..97305a3 100644 --- a/tcg/tcg-common.c +++ b/tcg/tcg-common.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg/tcg.h" #if defined(CONFIG_TCG_INTERPRETER) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 0b9dd8f..f554b86 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg.h" #include "tcg-op.h" diff --git a/tcg/tcg.c b/tcg/tcg.c index a163541..3ce02dc 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -26,7 +26,7 @@ #define USE_LIVENESS_ANALYSIS #define USE_TCG_OPTIMIZATIONS -#include "config.h" +#include "qemu/osdep.h" /* Define to jump the ELF file used to communicate with GDB. */ #undef DEBUG_JIT diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c index 4afe4d7..16ce048 100644 --- a/tcg/tci/tcg-target.c +++ b/tcg/tci/tcg-target.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "tcg-be-null.h" /* TODO list:
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- tcg/aarch64/tcg-target.c | 1 + tcg/arm/tcg-target.c | 1 + tcg/i386/tcg-target.c | 1 + tcg/mips/tcg-target.c | 2 +- tcg/optimize.c | 4 +--- tcg/ppc/tcg-target.c | 8 +------- tcg/s390/tcg-target.c | 1 + tcg/sparc/tcg-target.c | 1 + tcg/tcg-common.c | 1 + tcg/tcg-op.c | 1 + tcg/tcg.c | 2 +- tcg/tci/tcg-target.c | 1 + 12 files changed, 12 insertions(+), 12 deletions(-)