Message ID | 20240418192525.97451-18-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | include/exec: Rework (part 2) | expand |
On 4/18/24 12:25, Philippe Mathieu-Daudé wrote: > "exec/log.h" accesses the qemu_loglevel variable, > which is declared in "qemu/log-for-trace.h". > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/exec/log.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/exec/log.h b/include/exec/log.h > index 4a7375a45f..e0ff778a10 100644 > --- a/include/exec/log.h > +++ b/include/exec/log.h > @@ -2,6 +2,7 @@ > #define QEMU_EXEC_LOG_H > > #include "qemu/log.h" > +#include "qemu/log-for-trace.h" > #include "hw/core/cpu.h" > #include "disas/disas.h" > I disagree: qemu/log.h is the main file; log-for-trace.h was split out for other usage. That shouldn't mean that log-for-trace.h needs to be spread around. r~
On 21/4/24 18:44, Richard Henderson wrote: > On 4/18/24 12:25, Philippe Mathieu-Daudé wrote: >> "exec/log.h" accesses the qemu_loglevel variable, >> which is declared in "qemu/log-for-trace.h". >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> include/exec/log.h | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/include/exec/log.h b/include/exec/log.h >> index 4a7375a45f..e0ff778a10 100644 >> --- a/include/exec/log.h >> +++ b/include/exec/log.h >> @@ -2,6 +2,7 @@ >> #define QEMU_EXEC_LOG_H >> #include "qemu/log.h" >> +#include "qemu/log-for-trace.h" >> #include "hw/core/cpu.h" >> #include "disas/disas.h" > > I disagree: qemu/log.h is the main file; log-for-trace.h was split out > for other usage. That shouldn't mean that log-for-trace.h needs to be > spread around. Good point, I haven't noticed we can just move the qemu_loglevel declaration.
On 22/4/24 11:05, Philippe Mathieu-Daudé wrote: > On 21/4/24 18:44, Richard Henderson wrote: >> On 4/18/24 12:25, Philippe Mathieu-Daudé wrote: >>> "exec/log.h" accesses the qemu_loglevel variable, >>> which is declared in "qemu/log-for-trace.h". >>> >>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >>> --- >>> include/exec/log.h | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/include/exec/log.h b/include/exec/log.h >>> index 4a7375a45f..e0ff778a10 100644 >>> --- a/include/exec/log.h >>> +++ b/include/exec/log.h >>> @@ -2,6 +2,7 @@ >>> #define QEMU_EXEC_LOG_H >>> #include "qemu/log.h" >>> +#include "qemu/log-for-trace.h" >>> #include "hw/core/cpu.h" >>> #include "disas/disas.h" >> >> I disagree: qemu/log.h is the main file; log-for-trace.h was split out >> for other usage. That shouldn't mean that log-for-trace.h needs to be >> spread around. > > Good point, I haven't noticed we can just move the qemu_loglevel > declaration. Now I'm confused, I don't remember why I ended doing that, since "exec/log.h" includes "qemu/log.h" itself including "qemu/log-for-trace.h. I now notice commit be0aa7ac89 ("log-for-trace.h: Split out parts of log.h used by trace.h"): A persistent build problem we see is where a source file accidentally omits the #include of log.h. This slips through local developer testing because if you configure with the default (log) trace backend trace.h will pull in log.h for you. Compilation fails only if some other backend is selected. To make this error cause a compile failure regardless of the configured trace backend, split out the parts of log.h that trace.h requires into a new log-for-trace.h header. Since almost all manual uses of the log.h functions will use constants or functions which aren't in log-for-trace.h, this will let us catch missing #include "qemu/log.h" more consistently. Let's drop this patch. Thanks, Phil.
diff --git a/include/exec/log.h b/include/exec/log.h index 4a7375a45f..e0ff778a10 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -2,6 +2,7 @@ #define QEMU_EXEC_LOG_H #include "qemu/log.h" +#include "qemu/log-for-trace.h" #include "hw/core/cpu.h" #include "disas/disas.h"
"exec/log.h" accesses the qemu_loglevel variable, which is declared in "qemu/log-for-trace.h". Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/exec/log.h | 1 + 1 file changed, 1 insertion(+)