[Qemu-devel] [PATCH 3/4] Clean up a few header guard symbols

Markus Armbruster posted 4 patches 6 years, 8 months ago
Maintainers: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Aleksandar Rikalo <arikalo@wavecomp.com>, Jason Wang <jasowang@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, Aurelien Jarno <aurelien@aurel32.net>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Peter Maydell <peter.maydell@linaro.org>, Anthony Perard <anthony.perard@citrix.com>, Gerd Hoffmann <kraxel@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Helge Deller <deller@gmx.de>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>, Laurent Vivier <laurent@vivier.eu>, "Daniel P. Berrangé" <berrange@redhat.com>, Viktor Prutyanov <viktor.prutyanov@phystech.edu>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Aleksandar Markovic <amarkovic@wavecomp.com>, Palmer Dabbelt <palmer@sifive.com>, Anthony Green <green@moxielogic.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Greg Kurz <groug@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Richard Henderson <rth@twiddle.net>, Beniamino Galvani <b.galvani@gmail.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Stefano Stabellini <sstabellini@kernel.org>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Laszlo Ersek <lersek@redhat.com>, Paul Durrant <paul.durrant@citrix.com>, Alistair Francis <alistair@alistair23.me>, Thomas Huth <huth@tuxfamily.org>
[Qemu-devel] [PATCH 3/4] Clean up a few header guard symbols
Posted by Markus Armbruster 6 years, 8 months ago
Commit 58ea30f5145 "Clean up header guards that don't match their file
name" messed up contrib/elf2dmp/qemu_elf.h and
tests/migration/migration-test.h.

It missed target/cris/opcode-cris.h and
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
due to the scripts/clean-header-guards.pl bug fixed in the previous
commit.

Commit a8b991b52dc "Clean up ill-advised or unusual header guards"
missed include/hw/xen/io/ring.h for the same reason.

Commit 3979fca4b69 "disas: Rename include/disas/bfd.h back to
include/disas/dis-asm.h" neglected to update the guard symbol for the
rename.

Commit a331c6d7741 "semihosting: implement a semihosting console"
created include/hw/semihosting/console.h with an ill-advised guard
symbol.

Clean them up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 contrib/elf2dmp/qemu_elf.h                                  | 5 ++---
 include/disas/dis-asm.h                                     | 6 +++---
 include/hw/semihosting/console.h                            | 6 +++---
 include/hw/xen/io/ring.h                                    | 6 +++---
 target/cris/opcode-cris.h                                   | 6 +++---
 tests/migration/migration-test.h                            | 2 +-
 .../UefiTestToolsPkg/Include/Guid/BiosTablesTest.h          | 6 +++---
 7 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/contrib/elf2dmp/qemu_elf.h b/contrib/elf2dmp/qemu_elf.h
index 66ee1f0ed5..b2f0d9cbc9 100644
--- a/contrib/elf2dmp/qemu_elf.h
+++ b/contrib/elf2dmp/qemu_elf.h
@@ -2,11 +2,10 @@
  * Copyright (c) 2018 Virtuozzo International GmbH
  *
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
- *
  */
 
-#ifndef EMPF2DMP_QEMU_ELF_H
-#define EMPF2DMP_QEMU_ELF_H
+#ifndef ELF2DMP_QEMU_ELF_H
+#define ELF2DMP_QEMU_ELF_H
 
 #include "elf.h"
 
diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
index 9240ec32c2..e9c7dd8eb4 100644
--- a/include/disas/dis-asm.h
+++ b/include/disas/dis-asm.h
@@ -6,8 +6,8 @@
    interface, for making instruction-processing programs more independent
    of the instruction set being processed.  */
 
-#ifndef DISAS_BFD_H
-#define DISAS_BFD_H
+#ifndef DISAS_DIS_ASM_H
+#define DISAS_DIS_ASM_H
 
 typedef void *PTR;
 typedef uint64_t bfd_vma;
@@ -508,4 +508,4 @@ bfd_vma bfd_getl16 (const bfd_byte *addr);
 bfd_vma bfd_getb16 (const bfd_byte *addr);
 typedef bool bfd_boolean;
 
-#endif /* DISAS_BFD_H */
+#endif /* DISAS_DIS_ASM_H */
diff --git a/include/hw/semihosting/console.h b/include/hw/semihosting/console.h
index 30e66ae20a..9eb45b7c53 100644
--- a/include/hw/semihosting/console.h
+++ b/include/hw/semihosting/console.h
@@ -6,8 +6,8 @@
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
-#ifndef _SEMIHOST_CONSOLE_H_
-#define _SEMIHOST_CONSOLE_H_
+#ifndef SEMIHOST_CONSOLE_H
+#define SEMIHOST_CONSOLE_H
 
 /**
  * qemu_semihosting_console_out:
@@ -35,4 +35,4 @@ int qemu_semihosting_console_out(CPUArchState *env, target_ulong s, int len);
  */
 int qemu_semihosting_log_out(const char *s, int len);
 
-#endif /* _SEMIHOST_CONSOLE_H_ */
+#endif /* SEMIHOST_CONSOLE_H */
diff --git a/include/hw/xen/io/ring.h b/include/hw/xen/io/ring.h
index 1adacf09f9..62abfd7a6e 100644
--- a/include/hw/xen/io/ring.h
+++ b/include/hw/xen/io/ring.h
@@ -24,8 +24,8 @@
  * Tim Deegan and Andrew Warfield November 2004.
  */
 
-#ifndef __XEN_PUBLIC_IO_RING_H__
-#define __XEN_PUBLIC_IO_RING_H__
+#ifndef XEN_PUBLIC_IO_RING_H
+#define XEN_PUBLIC_IO_RING_H
 
 /*
  * When #include'ing this header, you need to provide the following
@@ -469,7 +469,7 @@ struct name##_data_intf {                                                     \
 };                                                                            \
 DEFINE_XEN_FLEX_RING(name)
 
-#endif /* __XEN_PUBLIC_IO_RING_H__ */
+#endif /* XEN_PUBLIC_IO_RING_H */
 
 /*
  * Local variables:
diff --git a/target/cris/opcode-cris.h b/target/cris/opcode-cris.h
index e7ebb98cd0..40509c88db 100644
--- a/target/cris/opcode-cris.h
+++ b/target/cris/opcode-cris.h
@@ -19,8 +19,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef __CRIS_H_INCLUDED_
-#define __CRIS_H_INCLUDED_
+#ifndef TARGET_CRIS_OPCODE_CRIS_H
+#define TARGET_CRIS_OPCODE_CRIS_H
 
 #if !defined(__STDC__) && !defined(const)
 #define const
@@ -345,7 +345,7 @@ extern const struct cris_opcode cris_opcodes[];
    sign-extended before adding to "target".  */
 #define CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD (1 << 7)
 
-#endif /* __CRIS_H_INCLUDED_ */
+#endif /* TARGET_CRIS_OPCODE_CRIS_H */
 
 /*
  * Local variables:
diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h
index aa3c3a9625..68512c0b1b 100644
--- a/tests/migration/migration-test.h
+++ b/tests/migration/migration-test.h
@@ -32,4 +32,4 @@
  */
 #define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024)
 
-#endif /* _MIGRATION_TEST_H */
+#endif /* MIGRATION_TEST_H */
diff --git a/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h b/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
index 7a74c121d5..07808787cc 100644
--- a/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
+++ b/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
@@ -21,8 +21,8 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
-#ifndef __BIOS_TABLES_TEST_H__
-#define __BIOS_TABLES_TEST_H__
+#ifndef BIOSTABLESTEST_H
+#define BIOSTABLESTEST_H
 
 #include <Uefi/UefiBaseType.h>
 
@@ -77,4 +77,4 @@ typedef struct {
 } BIOS_TABLES_TEST;
 #pragma pack ()
 
-#endif // __BIOS_TABLES_TEST_H__
+#endif /* BIOSTABLESTEST_H */
-- 
2.21.0


Re: [Qemu-devel] [PATCH 3/4] Clean up a few header guard symbols
Posted by Philippe Mathieu-Daudé 6 years, 8 months ago
On 6/4/19 8:16 PM, Markus Armbruster wrote:
> Commit 58ea30f5145 "Clean up header guards that don't match their file
> name" messed up contrib/elf2dmp/qemu_elf.h and
> tests/migration/migration-test.h.
> 
> It missed target/cris/opcode-cris.h and
> tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
> due to the scripts/clean-header-guards.pl bug fixed in the previous
> commit.
> 
> Commit a8b991b52dc "Clean up ill-advised or unusual header guards"
> missed include/hw/xen/io/ring.h for the same reason.
> 
> Commit 3979fca4b69 "disas: Rename include/disas/bfd.h back to
> include/disas/dis-asm.h" neglected to update the guard symbol for the
> rename.
> 
> Commit a331c6d7741 "semihosting: implement a semihosting console"
> created include/hw/semihosting/console.h with an ill-advised guard
> symbol.
> 
> Clean them up.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  contrib/elf2dmp/qemu_elf.h                                  | 5 ++---
>  include/disas/dis-asm.h                                     | 6 +++---
>  include/hw/semihosting/console.h                            | 6 +++---
>  include/hw/xen/io/ring.h                                    | 6 +++---
>  target/cris/opcode-cris.h                                   | 6 +++---
>  tests/migration/migration-test.h                            | 2 +-
>  .../UefiTestToolsPkg/Include/Guid/BiosTablesTest.h          | 6 +++---
>  7 files changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/contrib/elf2dmp/qemu_elf.h b/contrib/elf2dmp/qemu_elf.h
> index 66ee1f0ed5..b2f0d9cbc9 100644
> --- a/contrib/elf2dmp/qemu_elf.h
> +++ b/contrib/elf2dmp/qemu_elf.h
> @@ -2,11 +2,10 @@
>   * Copyright (c) 2018 Virtuozzo International GmbH
>   *
>   * This work is licensed under the terms of the GNU GPL, version 2 or later.
> - *
>   */
>  
> -#ifndef EMPF2DMP_QEMU_ELF_H
> -#define EMPF2DMP_QEMU_ELF_H
> +#ifndef ELF2DMP_QEMU_ELF_H
> +#define ELF2DMP_QEMU_ELF_H
>  
>  #include "elf.h"
>  
> diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
> index 9240ec32c2..e9c7dd8eb4 100644
> --- a/include/disas/dis-asm.h
> +++ b/include/disas/dis-asm.h
> @@ -6,8 +6,8 @@
>     interface, for making instruction-processing programs more independent
>     of the instruction set being processed.  */
>  
> -#ifndef DISAS_BFD_H
> -#define DISAS_BFD_H
> +#ifndef DISAS_DIS_ASM_H
> +#define DISAS_DIS_ASM_H
>  
>  typedef void *PTR;
>  typedef uint64_t bfd_vma;
> @@ -508,4 +508,4 @@ bfd_vma bfd_getl16 (const bfd_byte *addr);
>  bfd_vma bfd_getb16 (const bfd_byte *addr);
>  typedef bool bfd_boolean;
>  
> -#endif /* DISAS_BFD_H */
> +#endif /* DISAS_DIS_ASM_H */
> diff --git a/include/hw/semihosting/console.h b/include/hw/semihosting/console.h
> index 30e66ae20a..9eb45b7c53 100644
> --- a/include/hw/semihosting/console.h
> +++ b/include/hw/semihosting/console.h
> @@ -6,8 +6,8 @@
>   * SPDX-License-Identifier: GPL-2.0-or-later
>   */
>  
> -#ifndef _SEMIHOST_CONSOLE_H_
> -#define _SEMIHOST_CONSOLE_H_
> +#ifndef SEMIHOST_CONSOLE_H
> +#define SEMIHOST_CONSOLE_H
>  
>  /**
>   * qemu_semihosting_console_out:
> @@ -35,4 +35,4 @@ int qemu_semihosting_console_out(CPUArchState *env, target_ulong s, int len);
>   */
>  int qemu_semihosting_log_out(const char *s, int len);
>  
> -#endif /* _SEMIHOST_CONSOLE_H_ */
> +#endif /* SEMIHOST_CONSOLE_H */
> diff --git a/include/hw/xen/io/ring.h b/include/hw/xen/io/ring.h
> index 1adacf09f9..62abfd7a6e 100644
> --- a/include/hw/xen/io/ring.h
> +++ b/include/hw/xen/io/ring.h
> @@ -24,8 +24,8 @@
>   * Tim Deegan and Andrew Warfield November 2004.
>   */
>  
> -#ifndef __XEN_PUBLIC_IO_RING_H__
> -#define __XEN_PUBLIC_IO_RING_H__
> +#ifndef XEN_PUBLIC_IO_RING_H
> +#define XEN_PUBLIC_IO_RING_H
>  
>  /*
>   * When #include'ing this header, you need to provide the following
> @@ -469,7 +469,7 @@ struct name##_data_intf {                                                     \
>  };                                                                            \
>  DEFINE_XEN_FLEX_RING(name)
>  
> -#endif /* __XEN_PUBLIC_IO_RING_H__ */
> +#endif /* XEN_PUBLIC_IO_RING_H */
>  
>  /*
>   * Local variables:
> diff --git a/target/cris/opcode-cris.h b/target/cris/opcode-cris.h
> index e7ebb98cd0..40509c88db 100644
> --- a/target/cris/opcode-cris.h
> +++ b/target/cris/opcode-cris.h
> @@ -19,8 +19,8 @@ GNU General Public License for more details.
>  You should have received a copy of the GNU General Public License
>  along with this program; if not, see <http://www.gnu.org/licenses/>.  */
>  
> -#ifndef __CRIS_H_INCLUDED_
> -#define __CRIS_H_INCLUDED_
> +#ifndef TARGET_CRIS_OPCODE_CRIS_H
> +#define TARGET_CRIS_OPCODE_CRIS_H
>  
>  #if !defined(__STDC__) && !defined(const)
>  #define const
> @@ -345,7 +345,7 @@ extern const struct cris_opcode cris_opcodes[];
>     sign-extended before adding to "target".  */
>  #define CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD (1 << 7)
>  
> -#endif /* __CRIS_H_INCLUDED_ */
> +#endif /* TARGET_CRIS_OPCODE_CRIS_H */
>  
>  /*
>   * Local variables:
> diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h
> index aa3c3a9625..68512c0b1b 100644
> --- a/tests/migration/migration-test.h
> +++ b/tests/migration/migration-test.h
> @@ -32,4 +32,4 @@
>   */
>  #define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024)
>  
> -#endif /* _MIGRATION_TEST_H */
> +#endif /* MIGRATION_TEST_H */
> diff --git a/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h b/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
> index 7a74c121d5..07808787cc 100644
> --- a/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
> +++ b/tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
> @@ -21,8 +21,8 @@
>    WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>  **/
>  
> -#ifndef __BIOS_TABLES_TEST_H__
> -#define __BIOS_TABLES_TEST_H__
> +#ifndef BIOSTABLESTEST_H
> +#define BIOSTABLESTEST_H
>  
>  #include <Uefi/UefiBaseType.h>
>  
> @@ -77,4 +77,4 @@ typedef struct {
>  } BIOS_TABLES_TEST;
>  #pragma pack ()
>  
> -#endif // __BIOS_TABLES_TEST_H__
> +#endif /* BIOSTABLESTEST_H */
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>