Error: Fix build when qemu-common.h is not included
PATCH 1/1 Error: Fix build when qemu-common.h is not included
Commit e4ea5e2d0e0e4c5188ab45b66f3195062ae059dc added the use of the macro GCC_FMT_ATTR to error.h, however qemu-common.h is not included by error.h
This will cause a build error when files including error.h don't include qemu-common.h. Not an issue today because the only file including it is json-parser.h and it does include qemu-common.h, but let's fix it.
--- error.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
error.h +1 -1
@@ -12,7 +12,7 @@#ifndef ERROR_H #define ERROR_H -#include <stdbool.h> +#include "qemu-common.h" /** * A class representing internal errors within QEMU. An error has a string
Signature · 1 line
1.7.6.134.gcf13f
Quoted 19 lines · Luiz Capitulino
Commit
e4ea5e2d0e0e4c5188ab45b66f3195062ae059dcadded the use of the macroGCC_FMT_ATTRtoerror.h, howeverqemu-common.his not included byerror.hThis will cause a build error when files including
error.hdon't includeqemu-common.h. Not an issue today because the only file including it isjson-parser.hand it does includeqemu-common.h, but let's fix it.Signed-off-by Luiz Capitulino<[email protected]>--- error.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)error.h +0
-0
error.h line 18
Quoted 8 lines
error.h +1
-1@@ -12,7 +12,7 @@#ifndef ERROR_H #define ERROR_H -#include <stdbool.h> +#include "qemu-common.h" /** * A class representing internal errors within QEMU. An error has a string
Am 07.07.2011 18:17, schrieb Michael Roth:
Quoted 10 lines · Luiz Capitulino
Quoted 9 lines
Commit
e4ea5e2d0e0e4c5188ab45b66f3195062ae059dcadded the use of the macroGCC_FMT_ATTRtoerror.h, howeverqemu-common.his not included byerror.hThis will cause a build error when files including
error.hdon't includeqemu-common.h. Not an issue today because the only file including it isjson-parser.hand it does includeqemu-common.h, but let's fix it.
Quoted 4 lines
Quoted 4 lines
Signed-off-by Luiz Capitulino<[email protected]>--- error.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
The same argument could be applied to more QEMU *.h files which also work only after qemu-common.h. Otherwise, including qemu-common.h in *.c files would rarely be needed.
As far as I remember, the *.h files used to be more self-contained some years ago, but then the strategy changed and central files like qemu-common.h were introduced.
I personally prefer self-contained include files like error.h (before my patch and after your patch), but I'm afraid that the QEMU way is different.
Cheers,
Stefan W.
Quoted 20 lines · On Thu, 07 Jul 2011 18:50:28 +0200 Stefan Weil <[email protected]> wrote:
Am 07.07.2011 18:17, schrieb Michael Roth:
Quoted 10 lines · Luiz Capitulino
Quoted 9 lines
Commit
e4ea5e2d0e0e4c5188ab45b66f3195062ae059dcadded the use of the macroGCC_FMT_ATTRtoerror.h, howeverqemu-common.his not included byerror.hThis will cause a build error when files including
error.hdon't includeqemu-common.h. Not an issue today because the only file including it isjson-parser.hand it does includeqemu-common.h, but let's fix it.Quoted 4 lines
Quoted 4 lines
Signed-off-by Luiz Capitulino<[email protected]>--- error.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)The same argument could be applied to more QEMU *.h files which also work only after
qemu-common.h. Otherwise, includingqemu-common.hin *.c files would rarely be needed.
Quoted 7 lines
As far as I remember, the *.h files used to be more self-contained some years ago, but then the strategy changed and central files like
qemu-common.hwere introduced.I personally prefer self-contained include files like
error.h(before my patch and after your patch), but I'm afraid that the QEMU way is different.
The current way is broken. Some qemu header files are a complete mess. qemu-common.h and sysemu.h are good examples. They include too many things, if you change them a lot of code will be recompiled.
I could make the problem less worse by moving all compiler related macros to a compiler.h header and then include it in qemu-common.h and error.h. This way error.h won't be affected, although the real problem will remain unsolved.