Skip to contentSkip to conversation

tcg/tcg-op.h: Add multiple include guard

PATCH In review Peter Maydell 4 participants 7 messages Nov 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg/tcg-op.h: Add multiple include guard

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

---
 tcg/tcg-op.h | 5 +++++
 1 file changed, 5 insertions(+)
tcg/tcg-op.h +5 -0
index 7513c1eb7c5..db4e9188f42 100644
@@ -22,6 +22,9 @@
  * THE SOFTWARE.
  */
 
+#ifndef TCG_TCG_OP_H
+#define TCG_TCG_OP_H
+
 #include "tcg.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
@@ -1267,3 +1270,5 @@ static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
 
 #undef PTR
 #undef NAT
+
+#endif /* TCG_TCG_OP_H */
Signature · 1 line
2.19.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 4 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

I'm pretty sure there are more occurences.

Quoted 2 lines
Quoted 25 lines
---
  tcg/tcg-op.h | 5 +++++
  1 file changed, 5 insertions(+)
tcg/tcg-op.h +5 -0
index 7513c1eb7c5..db4e9188f42 100644
@@ -22,6 +22,9 @@
   * THE SOFTWARE.
   */
 
+#ifndef TCG_TCG_OP_H
+#define TCG_TCG_OP_H
+
  #include "tcg.h"
  #include "exec/helper-proto.h"
  #include "exec/helper-gen.h"
@@ -1267,3 +1270,5 @@ static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
 
  #undef PTR
  #undef NAT
+
+#endif /* TCG_TCG_OP_H */
#2 lore raw
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

I'm pretty sure there are more occurences.

The only other ones the analyzer spotted all seemed to be "deliberately multiply included" (like include/exec/memory_ldst_phys.inc.h), though we don't in all cases use the ".inc.h" convention that sort-of indicates that).

https://lgtm.com/projects/g/qemu/qemu/alerts/?mode=tree
is probably the most convenient url if you want to go looking for other stuff. Some of its issues are definitely false-positives, but there may be some other easy to fix things in there (eg the "local variable hides global variable" ones -- though if we care about these we should enable -Wshadow and fix the compile failures).

Notably, lgtm does checks on python, which Coverity does not, so that is more likely to be a source of real issues to fix, I think.

thanks
-- PMM

#3 lore raw
Quoted 26 lines · Peter Maydell
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

I'm pretty sure there are more occurences.

The only other ones the analyzer spotted all seemed to be "deliberately multiply included" (like include/exec/memory_ldst_phys.inc.h), though we don't in all cases use the ".inc.h" convention that sort-of indicates that).

https://lgtm.com/projects/g/qemu/qemu/alerts/?mode=tree
is probably the most convenient url if you want to go looking for other stuff. Some of its issues are definitely false-positives, but there may be some other easy to fix things in there (eg the "local variable hides global variable" ones -- though if we care about these we should enable -Wshadow and fix the compile failures).

Quoted 3 lines

Notably, lgtm does checks on python, which Coverity does not, so that is more likely to be a source of real issues to fix, I think.

Thanks for the pointer.

This stats are funny^H^H^H^Hscary:
https://lgtm.com/blog/best_email_domain#What%20about%20the%20free%20email%20providers?

Quoted 4 lines

thanks
-- PMM

Reviewed-by on v1 1/1
#4 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

Quoted 28 lines
---
 tcg/tcg-op.h | 5 +++++
 1 file changed, 5 insertions(+)
tcg/tcg-op.h +5 -1
index 7513c1eb7c5..db4e9188f42 100644
@@ -22,6 +22,9 @@
  * THE SOFTWARE.
  */
 
+#ifndef TCG_TCG_OP_H
+#define TCG_TCG_OP_H
+
 #include "tcg.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
@@ -1267,3 +1270,5 @@ static inline void tcg_gen_trunc_ptr_i32(TCGv_i32 r, TCGv_ptr a)
 
 #undef PTR
 #undef NAT
+
+#endif /* TCG_TCG_OP_H */
--

2.19.1

Signature · 1 line
Marc-André Lureau
Reviewed-by on v1 1/1
#5 lore raw
In reply to Peter Maydell
Quoted 9 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

---
 tcg/tcg-op.h | 5 +++++
 1 file changed, 5 insertions(+)

FWIW, while I can queue this, I do not have any other outstanding tcg patches.
So maybe just apply it to master directly?

r~

#6 lore raw
Quoted 11 lines · Richard Henderson
Quoted 9 lines · Peter Maydell

The tcg-op.h header was missing the usual guard against multiple inclusion; add it.

(Spotted by lgtm.com's static analyzer.)

---
 tcg/tcg-op.h | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 4 lines

FWIW, while I can queue this, I do not have any other outstanding tcg patches.
So maybe just apply it to master directly?

OK, applied to master.

-- PMM