Skip to contentSkip to conversation

cpus: fix wrong define name

PATCH Applied Nikunj A Dadhania 5 participants 8 messages Apr 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpus: fix wrong define name

While the configure script generates TARGET_SUPPORTS_MTTCG define, one of the define is cpus.c is checking wrong name: TARGET_SUPPORT_MTTCG

---
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +1 -1
index 68fdbc4..58d90aa 100644
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG
                 error_report("Guest not yet converted to MTTCG - "
                              "you may get unexpected results");
 #endif
Signature · 1 line
2.9.3
Applied
#1 lore raw
Quoted 13 lines · Nikunj A Dadhania

While the configure script generates TARGET_SUPPORTS_MTTCG define, one of the define is cpus.c is checking wrong name: TARGET_SUPPORT_MTTCG

---
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +0 -0
index 68fdbc4..58d90aa 100644

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 208

Quoted 8 lines
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG
                 error_report("Guest not yet converted to MTTCG - "
                              "you may get unexpected results");
 #endif

Opps that's embarrassing.

Applied to my tree, I'll be sending a pullreq today

--
Alex Bennée

#2 lore raw
In reply to Nikunj A Dadhania
Quoted 13 lines · Nikunj A Dadhania

While the configure script generates TARGET_SUPPORTS_MTTCG define, one of the define is cpus.c is checking wrong name: TARGET_SUPPORT_MTTCG

---
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +0 -0
index 68fdbc4..58d90aa 100644

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 5 lines
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG

This sort of thing is why glibc moved to using -Wundef.

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

r~

#3 lore raw
Quoted 13 lines · Richard Henderson

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 8 lines · Nikunj A Dadhania
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG

This sort of thing is why glibc moved to using -Wundef.

Quoted 2 lines

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

We already build with -Wundef...

thanks
-- PMM

#4 lore raw
Quoted 14 lines · Peter Maydell
Quoted 13 lines · Richard Henderson

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 8 lines · Nikunj A Dadhania
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG

This sort of thing is why glibc moved to using -Wundef.

Quoted 4 lines
Quoted 2 lines

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

We already build with -Wundef...

Ah, but then you also have to stop using #ifdef and #ifndef, and use only #if. Thus my incomplete comment above about conversion.

r~

#5 lore raw
In reply to Peter Maydell
Quoted 14 lines · On Mon, 10 Apr 2017 18:29:57 +0100 Peter Maydell <[email protected]>…
Quoted 13 lines · Richard Henderson

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 8 lines · Nikunj A Dadhania
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG  

This sort of thing is why glibc moved to using -Wundef.

Quoted 5 lines
Quoted 2 lines

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

We already build with -Wundef...

From the gcc info page:

'-Wundef'
Warn if an undefined identifier is evaluated in an '#if' directive.

and BTW, isn't the purpose of #ifndef precisely to detect that the identifier is undefined ?

Quoted 3 lines

thanks
-- PMM

#6 lore raw
Quoted 23 lines · Greg Kurz
Quoted 14 lines · On Mon, 10 Apr 2017 18:29:57 +0100 Peter Maydell <[email protected]>…
Quoted 13 lines · Richard Henderson

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 8 lines · Nikunj A Dadhania
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG

This sort of thing is why glibc moved to using -Wundef.

Quoted 5 lines
Quoted 2 lines

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

We already build with -Wundef...

Quoted 7 lines

From the gcc info page:

'-Wundef'
Warn if an undefined identifier is evaluated in an '#if' directive.

and BTW, isn't the purpose of #ifndef precisely to detect that the identifier is undefined ?

Yes, but it also has the typo problem above, whereas

  #if !TARGET_SUPPORTS_MTTCG

plus -Wundef would have caught that error.

r~

#7 lore raw
Quoted 29 lines · On Mon, 10 Apr 2017 10:49:12 -0700 Richard Henderson <[email protected]> wrote:
Quoted 28 lines · Greg Kurz
Quoted 14 lines · On Mon, 10 Apr 2017 18:29:57 +0100 Peter Maydell <[email protected]>…
Quoted 13 lines · Richard Henderson

cpus.c void qemu_tcg_configure(QemuOpts *opts, Error **errp) · line 205

Quoted 8 lines · Nikunj A Dadhania
cpus.c +1 -1
@@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
             } else if (use_icount) {
                 error_setg(errp, "No MTTCG when icount is enabled");
             } else {
-#ifndef TARGET_SUPPORT_MTTCG
+#ifndef TARGET_SUPPORTS_MTTCG  

This sort of thing is why glibc moved to using -Wundef.

Quoted 5 lines
Quoted 2 lines

It would be a huge amount of work to convert our existing sources, but it would probably pay off in the long run.

We already build with -Wundef...

From the gcc info page:

'-Wundef'
Warn if an undefined identifier is evaluated in an '#if' directive.

Quoted 9 lines
Quoted 2 lines

and BTW, isn't the purpose of #ifndef precisely to detect that the identifier is undefined ?

Yes, but it also has the typo problem above, whereas

   #if !TARGET_SUPPORTS_MTTCG

plus -Wundef would have caught that error.

Turning such #ifdef/#ifndef to #if/#if ! would indeed make sense, but we'd still have to be careful that every new addition follows the rule.

Quoted 2 lines

r~