diff mbox series

[3/8] linux-user/nios2 linux-user/riscv: Clean up header guards

Message ID 20190315145123.28030-4-armbru@redhat.com
State New
Headers show
Series Clean up #include "..." vs "<...>" and header guards | expand

Commit Message

Markus Armbruster March 15, 2019, 2:51 p.m. UTC
Reuse of the same guard symbol in multiple headers is okay as long as
they cannot be included together.  scripts/clean-header-guards.pl
can't tell, so it warns.

Since we can avoid guard symbol reuse easily, do so: use guard symbol
${target^^}_${fname^^} for linux-user/$target/$fname, just like we did
in commit a9c94277f0..3500385697.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 linux-user/nios2/target_cpu.h     | 4 ++--
 linux-user/nios2/target_signal.h  | 6 +++---
 linux-user/nios2/target_structs.h | 4 ++--
 linux-user/nios2/target_syscall.h | 6 +++---
 linux-user/riscv/target_cpu.h     | 4 ++--
 linux-user/riscv/target_signal.h  | 6 +++---
 linux-user/riscv/target_structs.h | 4 ++--
 7 files changed, 17 insertions(+), 17 deletions(-)

Comments

Philippe Mathieu-Daudé March 15, 2019, 4:09 p.m. UTC | #1
On 3/15/19 3:51 PM, Markus Armbruster wrote:
> Reuse of the same guard symbol in multiple headers is okay as long as
> they cannot be included together.  scripts/clean-header-guards.pl
> can't tell, so it warns.
> 
> Since we can avoid guard symbol reuse easily, do so: use guard symbol
> ${target^^}_${fname^^} for linux-user/$target/$fname, just like we did
> in commit a9c94277f0..3500385697.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

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

> ---
>  linux-user/nios2/target_cpu.h     | 4 ++--
>  linux-user/nios2/target_signal.h  | 6 +++---
>  linux-user/nios2/target_structs.h | 4 ++--
>  linux-user/nios2/target_syscall.h | 6 +++---
>  linux-user/riscv/target_cpu.h     | 4 ++--
>  linux-user/riscv/target_signal.h  | 6 +++---
>  linux-user/riscv/target_structs.h | 4 ++--
>  7 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h
> index 14f63338fa..5596c05c9c 100644
> --- a/linux-user/nios2/target_cpu.h
> +++ b/linux-user/nios2/target_cpu.h
> @@ -17,8 +17,8 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#ifndef TARGET_CPU_H
> -#define TARGET_CPU_H
> +#ifndef NIOS2_TARGET_CPU_H
> +#define NIOS2_TARGET_CPU_H
>  
>  static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp)
>  {
> diff --git a/linux-user/nios2/target_signal.h b/linux-user/nios2/target_signal.h
> index 7776bcdbfd..fe48721b3d 100644
> --- a/linux-user/nios2/target_signal.h
> +++ b/linux-user/nios2/target_signal.h
> @@ -1,5 +1,5 @@
> -#ifndef TARGET_SIGNAL_H
> -#define TARGET_SIGNAL_H
> +#ifndef NIOS2_TARGET_SIGNAL_H
> +#define NIOS2_TARGET_SIGNAL_H
>  
>  /* this struct defines a stack used during syscall handling */
>  
> @@ -18,4 +18,4 @@ typedef struct target_sigaltstack {
>  
>  #include "../generic/signal.h"
>  
> -#endif /* TARGET_SIGNAL_H */
> +#endif /* NIOS2_TARGET_SIGNAL_H */
> diff --git a/linux-user/nios2/target_structs.h b/linux-user/nios2/target_structs.h
> index 8713772089..7145251706 100644
> --- a/linux-user/nios2/target_structs.h
> +++ b/linux-user/nios2/target_structs.h
> @@ -16,8 +16,8 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> -#ifndef TARGET_STRUCTS_H
> -#define TARGET_STRUCTS_H
> +#ifndef NIOS2_TARGET_STRUCTS_H
> +#define NIOS2_TARGET_STRUCTS_H
>  
>  struct target_ipc_perm {
>      abi_int __key;                      /* Key.  */
> diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
> index ca6b7e69f6..f3b2a500f4 100644
> --- a/linux-user/nios2/target_syscall.h
> +++ b/linux-user/nios2/target_syscall.h
> @@ -1,5 +1,5 @@
> -#ifndef TARGET_SYSCALL_H
> -#define TARGET_SYSCALL_H
> +#ifndef NIOS2_TARGET_SYSCALL_H
> +#define NIOS2_TARGET_SYSCALL_H
>  
>  #define UNAME_MACHINE "nios2"
>  #define UNAME_MINIMUM_RELEASE "3.19.0"
> @@ -34,4 +34,4 @@ struct target_pt_regs {
>  #define TARGET_MLOCKALL_MCL_CURRENT 1
>  #define TARGET_MLOCKALL_MCL_FUTURE  2
>  
> -#endif  /* TARGET_SYSCALL_H */
> +#endif /* NIOS2_TARGET_SYSCALL_H */
> diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h
> index 7e090f376a..90f9a4171e 100644
> --- a/linux-user/riscv/target_cpu.h
> +++ b/linux-user/riscv/target_cpu.h
> @@ -1,5 +1,5 @@
> -#ifndef TARGET_CPU_H
> -#define TARGET_CPU_H
> +#ifndef RISCV_TARGET_CPU_H
> +#define RISCV_TARGET_CPU_H
>  
>  static inline void cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
>  {
> diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
> index c8b1455800..f113ba9a55 100644
> --- a/linux-user/riscv/target_signal.h
> +++ b/linux-user/riscv/target_signal.h
> @@ -1,5 +1,5 @@
> -#ifndef TARGET_SIGNAL_H
> -#define TARGET_SIGNAL_H
> +#ifndef RISCV_TARGET_SIGNAL_H
> +#define RISCV_TARGET_SIGNAL_H
>  
>  typedef struct target_sigaltstack {
>      abi_ulong ss_sp;
> @@ -15,4 +15,4 @@ typedef struct target_sigaltstack {
>  
>  #include "../generic/signal.h"
>  
> -#endif /* TARGET_SIGNAL_H */
> +#endif /* RISCV_TARGET_SIGNAL_H */
> diff --git a/linux-user/riscv/target_structs.h b/linux-user/riscv/target_structs.h
> index 4f0462c497..ea3e5ed17e 100644
> --- a/linux-user/riscv/target_structs.h
> +++ b/linux-user/riscv/target_structs.h
> @@ -4,8 +4,8 @@
>   * This is a copy of ../aarch64/target_structs.h atm.
>   *
>   */
> -#ifndef TARGET_STRUCTS_H
> -#define TARGET_STRUCTS_H
> +#ifndef RISCV_TARGET_STRUCTS_H
> +#define RISCV_TARGET_STRUCTS_H
>  
>  struct target_ipc_perm {
>      abi_int __key;                      /* Key.  */
>
Alistair Francis March 23, 2019, 6:50 a.m. UTC | #2
On Fri, Mar 15, 2019 at 6:17 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> On 3/15/19 3:51 PM, Markus Armbruster wrote:
> > Reuse of the same guard symbol in multiple headers is okay as long as
> > they cannot be included together.  scripts/clean-header-guards.pl
> > can't tell, so it warns.
> >
> > Since we can avoid guard symbol reuse easily, do so: use guard symbol
> > ${target^^}_${fname^^} for linux-user/$target/$fname, just like we did
> > in commit a9c94277f0..3500385697.
> >
> > Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> > ---
> >  linux-user/nios2/target_cpu.h     | 4 ++--
> >  linux-user/nios2/target_signal.h  | 6 +++---
> >  linux-user/nios2/target_structs.h | 4 ++--
> >  linux-user/nios2/target_syscall.h | 6 +++---
> >  linux-user/riscv/target_cpu.h     | 4 ++--
> >  linux-user/riscv/target_signal.h  | 6 +++---
> >  linux-user/riscv/target_structs.h | 4 ++--
> >  7 files changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h
> > index 14f63338fa..5596c05c9c 100644
> > --- a/linux-user/nios2/target_cpu.h
> > +++ b/linux-user/nios2/target_cpu.h
> > @@ -17,8 +17,8 @@
> >   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> >   */
> >
> > -#ifndef TARGET_CPU_H
> > -#define TARGET_CPU_H
> > +#ifndef NIOS2_TARGET_CPU_H
> > +#define NIOS2_TARGET_CPU_H
> >
> >  static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp)
> >  {
> > diff --git a/linux-user/nios2/target_signal.h b/linux-user/nios2/target_signal.h
> > index 7776bcdbfd..fe48721b3d 100644
> > --- a/linux-user/nios2/target_signal.h
> > +++ b/linux-user/nios2/target_signal.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SIGNAL_H
> > -#define TARGET_SIGNAL_H
> > +#ifndef NIOS2_TARGET_SIGNAL_H
> > +#define NIOS2_TARGET_SIGNAL_H
> >
> >  /* this struct defines a stack used during syscall handling */
> >
> > @@ -18,4 +18,4 @@ typedef struct target_sigaltstack {
> >
> >  #include "../generic/signal.h"
> >
> > -#endif /* TARGET_SIGNAL_H */
> > +#endif /* NIOS2_TARGET_SIGNAL_H */
> > diff --git a/linux-user/nios2/target_structs.h b/linux-user/nios2/target_structs.h
> > index 8713772089..7145251706 100644
> > --- a/linux-user/nios2/target_structs.h
> > +++ b/linux-user/nios2/target_structs.h
> > @@ -16,8 +16,8 @@
> >   * You should have received a copy of the GNU Lesser General Public
> >   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> >   */
> > -#ifndef TARGET_STRUCTS_H
> > -#define TARGET_STRUCTS_H
> > +#ifndef NIOS2_TARGET_STRUCTS_H
> > +#define NIOS2_TARGET_STRUCTS_H
> >
> >  struct target_ipc_perm {
> >      abi_int __key;                      /* Key.  */
> > diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
> > index ca6b7e69f6..f3b2a500f4 100644
> > --- a/linux-user/nios2/target_syscall.h
> > +++ b/linux-user/nios2/target_syscall.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SYSCALL_H
> > -#define TARGET_SYSCALL_H
> > +#ifndef NIOS2_TARGET_SYSCALL_H
> > +#define NIOS2_TARGET_SYSCALL_H
> >
> >  #define UNAME_MACHINE "nios2"
> >  #define UNAME_MINIMUM_RELEASE "3.19.0"
> > @@ -34,4 +34,4 @@ struct target_pt_regs {
> >  #define TARGET_MLOCKALL_MCL_CURRENT 1
> >  #define TARGET_MLOCKALL_MCL_FUTURE  2
> >
> > -#endif  /* TARGET_SYSCALL_H */
> > +#endif /* NIOS2_TARGET_SYSCALL_H */
> > diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h
> > index 7e090f376a..90f9a4171e 100644
> > --- a/linux-user/riscv/target_cpu.h
> > +++ b/linux-user/riscv/target_cpu.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_CPU_H
> > -#define TARGET_CPU_H
> > +#ifndef RISCV_TARGET_CPU_H
> > +#define RISCV_TARGET_CPU_H
> >
> >  static inline void cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
> >  {
> > diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
> > index c8b1455800..f113ba9a55 100644
> > --- a/linux-user/riscv/target_signal.h
> > +++ b/linux-user/riscv/target_signal.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SIGNAL_H
> > -#define TARGET_SIGNAL_H
> > +#ifndef RISCV_TARGET_SIGNAL_H
> > +#define RISCV_TARGET_SIGNAL_H
> >
> >  typedef struct target_sigaltstack {
> >      abi_ulong ss_sp;
> > @@ -15,4 +15,4 @@ typedef struct target_sigaltstack {
> >
> >  #include "../generic/signal.h"
> >
> > -#endif /* TARGET_SIGNAL_H */
> > +#endif /* RISCV_TARGET_SIGNAL_H */
> > diff --git a/linux-user/riscv/target_structs.h b/linux-user/riscv/target_structs.h
> > index 4f0462c497..ea3e5ed17e 100644
> > --- a/linux-user/riscv/target_structs.h
> > +++ b/linux-user/riscv/target_structs.h
> > @@ -4,8 +4,8 @@
> >   * This is a copy of ../aarch64/target_structs.h atm.
> >   *
> >   */
> > -#ifndef TARGET_STRUCTS_H
> > -#define TARGET_STRUCTS_H
> > +#ifndef RISCV_TARGET_STRUCTS_H
> > +#define RISCV_TARGET_STRUCTS_H
> >
> >  struct target_ipc_perm {
> >      abi_int __key;                      /* Key.  */
> >
>
diff mbox series

Patch

diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h
index 14f63338fa..5596c05c9c 100644
--- a/linux-user/nios2/target_cpu.h
+++ b/linux-user/nios2/target_cpu.h
@@ -17,8 +17,8 @@ 
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef TARGET_CPU_H
-#define TARGET_CPU_H
+#ifndef NIOS2_TARGET_CPU_H
+#define NIOS2_TARGET_CPU_H
 
 static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp)
 {
diff --git a/linux-user/nios2/target_signal.h b/linux-user/nios2/target_signal.h
index 7776bcdbfd..fe48721b3d 100644
--- a/linux-user/nios2/target_signal.h
+++ b/linux-user/nios2/target_signal.h
@@ -1,5 +1,5 @@ 
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
+#ifndef NIOS2_TARGET_SIGNAL_H
+#define NIOS2_TARGET_SIGNAL_H
 
 /* this struct defines a stack used during syscall handling */
 
@@ -18,4 +18,4 @@  typedef struct target_sigaltstack {
 
 #include "../generic/signal.h"
 
-#endif /* TARGET_SIGNAL_H */
+#endif /* NIOS2_TARGET_SIGNAL_H */
diff --git a/linux-user/nios2/target_structs.h b/linux-user/nios2/target_structs.h
index 8713772089..7145251706 100644
--- a/linux-user/nios2/target_structs.h
+++ b/linux-user/nios2/target_structs.h
@@ -16,8 +16,8 @@ 
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef TARGET_STRUCTS_H
-#define TARGET_STRUCTS_H
+#ifndef NIOS2_TARGET_STRUCTS_H
+#define NIOS2_TARGET_STRUCTS_H
 
 struct target_ipc_perm {
     abi_int __key;                      /* Key.  */
diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
index ca6b7e69f6..f3b2a500f4 100644
--- a/linux-user/nios2/target_syscall.h
+++ b/linux-user/nios2/target_syscall.h
@@ -1,5 +1,5 @@ 
-#ifndef TARGET_SYSCALL_H
-#define TARGET_SYSCALL_H
+#ifndef NIOS2_TARGET_SYSCALL_H
+#define NIOS2_TARGET_SYSCALL_H
 
 #define UNAME_MACHINE "nios2"
 #define UNAME_MINIMUM_RELEASE "3.19.0"
@@ -34,4 +34,4 @@  struct target_pt_regs {
 #define TARGET_MLOCKALL_MCL_CURRENT 1
 #define TARGET_MLOCKALL_MCL_FUTURE  2
 
-#endif  /* TARGET_SYSCALL_H */
+#endif /* NIOS2_TARGET_SYSCALL_H */
diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h
index 7e090f376a..90f9a4171e 100644
--- a/linux-user/riscv/target_cpu.h
+++ b/linux-user/riscv/target_cpu.h
@@ -1,5 +1,5 @@ 
-#ifndef TARGET_CPU_H
-#define TARGET_CPU_H
+#ifndef RISCV_TARGET_CPU_H
+#define RISCV_TARGET_CPU_H
 
 static inline void cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
 {
diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
index c8b1455800..f113ba9a55 100644
--- a/linux-user/riscv/target_signal.h
+++ b/linux-user/riscv/target_signal.h
@@ -1,5 +1,5 @@ 
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
+#ifndef RISCV_TARGET_SIGNAL_H
+#define RISCV_TARGET_SIGNAL_H
 
 typedef struct target_sigaltstack {
     abi_ulong ss_sp;
@@ -15,4 +15,4 @@  typedef struct target_sigaltstack {
 
 #include "../generic/signal.h"
 
-#endif /* TARGET_SIGNAL_H */
+#endif /* RISCV_TARGET_SIGNAL_H */
diff --git a/linux-user/riscv/target_structs.h b/linux-user/riscv/target_structs.h
index 4f0462c497..ea3e5ed17e 100644
--- a/linux-user/riscv/target_structs.h
+++ b/linux-user/riscv/target_structs.h
@@ -4,8 +4,8 @@ 
  * This is a copy of ../aarch64/target_structs.h atm.
  *
  */
-#ifndef TARGET_STRUCTS_H
-#define TARGET_STRUCTS_H
+#ifndef RISCV_TARGET_STRUCTS_H
+#define RISCV_TARGET_STRUCTS_H
 
 struct target_ipc_perm {
     abi_int __key;                      /* Key.  */