disas/arm: Remove redefinition of ATTRIBUTE_UNUSED
PATCH 1/1 disas/arm: Remove redefinition of ATTRIBUTE_UNUSED
ATTRIBUTE_UNUSED is already defined in disas/bfd.h, which is included. Thus, there is no need to redefine it.
--- disas/arm.c | 1 - 1 file changed, 1 deletion(-)
disas/arm.c +0 -1
@@ -23,7 +23,6 @@for things we don't care about. */ #include "disas/bfd.h" -#define ATTRIBUTE_UNUSED __attribute__((unused))#define ISSPACE (x) ((x) == ' ' || (x) == '\t' || (x) == '\n')#define ARM_EXT_V1 0
Signature · 1 line
2.0.1
Quoted 2 lines · Tobias Klauser
ATTRIBUTE_UNUSEDis already defined indisas/bfd.h, which is included. Thus, there is no need to redefine it.
Is there any harm in keeping it here?
While it really is a redifinition, I'm not sure what's the right thing here. This whole code is not from qemu, it is an external source imported, and that source is being maintained (but under different license as has already been discussed, so keeping changes at minimum might not be that good idea anymore). On the other hand this symbol is so common it should be defined in a common header. Yet on another hand, for these external sources wich has public API, it might not be a good idea to define it in a header to start with, because it might clash with project-local define, so it might be better to define it in either private header or in individual source.
Oh well, so much for so trivial thing... ;)
/mjt
Quoted 18 lines
Signed-off-by Tobias Klauser <[email protected]>--- disas/arm.c | 1 - 1 file changed, 1 deletion(-)disas/arm.c +0
-1@@ -23,7 +23,6 @@for things we don't care about. */ #include "disas/bfd.h" -#define ATTRIBUTE_UNUSED __attribute__((unused))#define ISSPACE (x) ((x) == ' ' || (x) == '\t' || (x) == '\n')#define ARM_EXT_V1 0
Quoted 6 lines · Michael Tokarev
Quoted 2 lines · Tobias Klauser
ATTRIBUTE_UNUSEDis already defined indisas/bfd.h, which is included. Thus, there is no need to redefine it.Is there any harm in keeping it here?
Quoted 10 lines
While it really is a redifinition, I'm not sure what's the right thing here. This whole code is not from qemu, it is an external source imported, and that source is being maintained (but under different license as has already been discussed, so keeping changes at minimum might not be that good idea anymore). On the other hand this symbol is so common it should be defined in a common header. Yet on another hand, for these external sources wich has public API, it might not be a good idea to define it in a header to start with, because it might clash with project-local define, so it might be better to define it in either private header or in individual source.
So my take on the disas/ sources is:
* yes, they're from an external source
* but as you say, we're never going to take another drop from that external source so we should feel free to make local bugfixes and changes as we need to
* on the other hand, there's no point in making gratuitous changes to them (they're never going to match the QEMU coding style, for instance)
So what's the rationale for this particular change? The duplication is harmless, so why worry about it...
-- PMM
Quoted 27 lines · Peter Maydell
Quoted 6 lines · Michael Tokarev
Quoted 2 lines · Tobias Klauser
ATTRIBUTE_UNUSEDis already defined indisas/bfd.h, which is included. Thus, there is no need to redefine it.Is there any harm in keeping it here?
Quoted 10 lines
While it really is a redifinition, I'm not sure what's the right thing here. This whole code is not from qemu, it is an external source imported, and that source is being maintained (but under different license as has already been discussed, so keeping changes at minimum might not be that good idea anymore). On the other hand this symbol is so common it should be defined in a common header. Yet on another hand, for these external sources wich has public API, it might not be a good idea to define it in a header to start with, because it might clash with project-local define, so it might be better to define it in either private header or in individual source.
So my take on the disas/ sources is:
* yes, they're from an external source
* but as you say, we're never going to take another drop from that external source so we should feel free to make local bugfixes and changes as we need to
* on the other hand, there's no point in making gratuitous changes to them (they're never going to match the QEMU coding style, for instance)
Quoted 2 lines
So what's the rationale for this particular change? The duplication is harmless, so why worry about it...
There's no particular reason, I just found it odd to see a redefinition of the macro there and I didn't know about the external source of the code - please just ignore the patch then.
Thanks
Tobias
Quoted 5 lines · Michael Tokarev
Quoted 2 lines · Tobias Klauser
ATTRIBUTE_UNUSEDis already defined indisas/bfd.h, which is included. Thus, there is no need to redefine it.Is there any harm in keeping it here?
No.
Quoted 10 lines
While it really is a redifinition, I'm not sure what's the right thing here. This whole code is not from qemu, it is an external source imported, and that source is being maintained (but under different license as has already been discussed, so keeping changes at minimum might not be that good idea anymore). On the other hand this symbol is so common it should be defined in a common header. Yet on another hand, for these external sources wich has public API, it might not be a good idea to define it in a header to start with, because it might clash with project-local define, so it might be better to define it in either private header or in individual source.
Ah, I didn't know it was non-qemu code (but now that I look at it again, I probably should have realized that sooner ;). Thanks for the explanation.
Quoted 1 line
Oh well, so much for so trivial thing... ;)
:) Sorry, it wasn't my intention to cause much discussion, trouble or work for maintainers with that patch. I don't feel strongly about, I just stumbled across it when browsing the source and found it odd to see a macro defined just below the #include of a header which defines the same macro.
Please just ignore the patch then :)
Thanks
Tobias