diff mbox series

[17/24] exec: Include missing 'qemu/log-for-trace.h' header in 'exec/log.h'

Message ID 20240418192525.97451-18-philmd@linaro.org
State New
Headers show
Series include/exec: Rework (part 2) | expand

Commit Message

Philippe Mathieu-Daudé April 18, 2024, 7:25 p.m. UTC
"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(+)

Comments

Richard Henderson April 21, 2024, 4:44 p.m. UTC | #1
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~
Philippe Mathieu-Daudé April 22, 2024, 9:05 a.m. UTC | #2
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.
Philippe Mathieu-Daudé April 22, 2024, 11:44 a.m. UTC | #3
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 mbox series

Patch

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"