diff mbox series

[kvm-unit-tests,v2,2/7] lib: unify header guards

Message ID 20210609143712.60933-3-cohuck@redhat.com
State New
Headers show
Series unify header guards | expand

Commit Message

Cornelia Huck June 9, 2021, 2:37 p.m. UTC
Standardize header guards to _LIB_HEADER_H_.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 lib/alloc_page.h       | 4 ++--
 lib/libcflat.h         | 4 ++--
 lib/list.h             | 4 ++--
 lib/pci-edu.h          | 4 ++--
 lib/pci-host-generic.h | 4 ++--
 lib/setjmp.h           | 4 ++--
 lib/string.h           | 6 +++---
 lib/vmalloc.h          | 4 ++--
 8 files changed, 17 insertions(+), 17 deletions(-)

Comments

David Hildenbrand June 9, 2021, 2:45 p.m. UTC | #1
On 09.06.21 16:37, Cornelia Huck wrote:
> Standardize header guards to _LIB_HEADER_H_.
> 
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
>   lib/alloc_page.h       | 4 ++--
>   lib/libcflat.h         | 4 ++--
>   lib/list.h             | 4 ++--
>   lib/pci-edu.h          | 4 ++--
>   lib/pci-host-generic.h | 4 ++--
>   lib/setjmp.h           | 4 ++--
>   lib/string.h           | 6 +++---
>   lib/vmalloc.h          | 4 ++--
>   8 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 1af1419d49b6..eed2ba06eeaf 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -5,8 +5,8 @@
>    * with byte granularity.
>    */
>   
> -#ifndef ALLOC_PAGE_H
> -#define ALLOC_PAGE_H 1
> +#ifndef _ALLOC_PAGE_H_
> +#define _ALLOC_PAGE_H_
>   
>   #include <stdbool.h>
>   #include <asm/memory_areas.h>
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 460a1234ea6a..f40b431d1550 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -17,8 +17,8 @@
>    * Authors: Hollis Blanchard <hollisb@us.ibm.com>
>    */
>   
> -#ifndef __LIBCFLAT_H
> -#define __LIBCFLAT_H
> +#ifndef _LIBCFLAT_H_
> +#define _LIBCFLAT_H_
>   
>   #ifndef __ASSEMBLY__
>   
> diff --git a/lib/list.h b/lib/list.h
> index 7f9717ef6258..ed3e52b40075 100644
> --- a/lib/list.h
> +++ b/lib/list.h
> @@ -1,5 +1,5 @@
> -#ifndef LIST_H
> -#define LIST_H
> +#ifndef _LIST_H_
> +#define _LIST_H_
>   
>   #include <stdbool.h>
>   
> diff --git a/lib/pci-edu.h b/lib/pci-edu.h
> index 44b4ba168768..9db94aec0bc7 100644
> --- a/lib/pci-edu.h
> +++ b/lib/pci-edu.h
> @@ -12,8 +12,8 @@
>    * Edu device is a virtualized device in QEMU. Please refer to
>    * docs/specs/edu.txt in QEMU repository for EDU device manual.
>    */
> -#ifndef __PCI_EDU_H__
> -#define __PCI_EDU_H__
> +#ifndef _PCI_EDU_H_
> +#define _PCI_EDU_H_
>   
>   #include "pci.h"
>   #include "asm/io.h"
> diff --git a/lib/pci-host-generic.h b/lib/pci-host-generic.h
> index 0ffe6380ec8f..3020ee22c837 100644
> --- a/lib/pci-host-generic.h
> +++ b/lib/pci-host-generic.h
> @@ -1,5 +1,5 @@
> -#ifndef PCI_HOST_GENERIC_H
> -#define PCI_HOST_GENERIC_H
> +#ifndef _PCI_HOST_GENERIC_H_
> +#define _PCI_HOST_GENERIC_H_
>   /*
>    * PCI host bridge supporting structures and constants
>    *
> diff --git a/lib/setjmp.h b/lib/setjmp.h
> index 2c56b4c68aaa..6afdf665681a 100644
> --- a/lib/setjmp.h
> +++ b/lib/setjmp.h
> @@ -4,8 +4,8 @@
>    * This code is free software; you can redistribute it and/or modify it
>    * under the terms of the GNU Library General Public License version 2.
>    */
> -#ifndef LIBCFLAT_SETJMP_H
> -#define LIBCFLAT_SETJMP_H 1
> +#ifndef _LIBCFLAT_SETJMP_H_
> +#define _LIBCFLAT_SETJMP_H_
>   
>   typedef struct jmp_buf_tag {
>   	long int regs[8];
> diff --git a/lib/string.h b/lib/string.h
> index e1febfed7fb2..b07763eaef10 100644
> --- a/lib/string.h
> +++ b/lib/string.h
> @@ -4,8 +4,8 @@
>    * This code is free software; you can redistribute it and/or modify it
>    * under the terms of the GNU Library General Public License version 2.
>    */
> -#ifndef __STRING_H
> -#define __STRING_H
> +#ifndef _STRING_H_
> +#define _STRING_H_
>   
>   extern size_t strlen(const char *buf);
>   extern size_t strnlen(const char *buf, size_t maxlen);
> @@ -23,4 +23,4 @@ extern int memcmp(const void *s1, const void *s2, size_t n);
>   extern void *memmove(void *dest, const void *src, size_t n);
>   extern void *memchr(const void *s, int c, size_t n);
>   
> -#endif /* _STRING_H */
> +#endif /* _STRING_H_ */
> diff --git a/lib/vmalloc.h b/lib/vmalloc.h
> index 8b158f591d75..346f94f198c5 100644
> --- a/lib/vmalloc.h
> +++ b/lib/vmalloc.h
> @@ -1,5 +1,5 @@
> -#ifndef VMALLOC_H
> -#define VMALLOC_H 1
> +#ifndef _VMALLOC_H_
> +#define _VMALLOC_H_
>   
>   #include <asm/page.h>
>   
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
Laurent Vivier June 9, 2021, 3:13 p.m. UTC | #2
On 09/06/2021 16:37, Cornelia Huck wrote:
> Standardize header guards to _LIB_HEADER_H_.
> 
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
>  lib/alloc_page.h       | 4 ++--
>  lib/libcflat.h         | 4 ++--
>  lib/list.h             | 4 ++--
>  lib/pci-edu.h          | 4 ++--
>  lib/pci-host-generic.h | 4 ++--
>  lib/setjmp.h           | 4 ++--
>  lib/string.h           | 6 +++---
>  lib/vmalloc.h          | 4 ++--
>  8 files changed, 17 insertions(+), 17 deletions(-)

What about lib/argv.h and lib/pci.h?

And there is also this instance of CONFIG_H in lib/config.h generated by configure.

Thanks,
Laurent


> 
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 1af1419d49b6..eed2ba06eeaf 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -5,8 +5,8 @@
>   * with byte granularity.
>   */
>  
> -#ifndef ALLOC_PAGE_H
> -#define ALLOC_PAGE_H 1
> +#ifndef _ALLOC_PAGE_H_
> +#define _ALLOC_PAGE_H_
>  
>  #include <stdbool.h>
>  #include <asm/memory_areas.h>
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 460a1234ea6a..f40b431d1550 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -17,8 +17,8 @@
>   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
>   */
>  
> -#ifndef __LIBCFLAT_H
> -#define __LIBCFLAT_H
> +#ifndef _LIBCFLAT_H_
> +#define _LIBCFLAT_H_
>  
>  #ifndef __ASSEMBLY__
>  
> diff --git a/lib/list.h b/lib/list.h
> index 7f9717ef6258..ed3e52b40075 100644
> --- a/lib/list.h
> +++ b/lib/list.h
> @@ -1,5 +1,5 @@
> -#ifndef LIST_H
> -#define LIST_H
> +#ifndef _LIST_H_
> +#define _LIST_H_
>  
>  #include <stdbool.h>
>  
> diff --git a/lib/pci-edu.h b/lib/pci-edu.h
> index 44b4ba168768..9db94aec0bc7 100644
> --- a/lib/pci-edu.h
> +++ b/lib/pci-edu.h
> @@ -12,8 +12,8 @@
>   * Edu device is a virtualized device in QEMU. Please refer to
>   * docs/specs/edu.txt in QEMU repository for EDU device manual.
>   */
> -#ifndef __PCI_EDU_H__
> -#define __PCI_EDU_H__
> +#ifndef _PCI_EDU_H_
> +#define _PCI_EDU_H_
>  
>  #include "pci.h"
>  #include "asm/io.h"
> diff --git a/lib/pci-host-generic.h b/lib/pci-host-generic.h
> index 0ffe6380ec8f..3020ee22c837 100644
> --- a/lib/pci-host-generic.h
> +++ b/lib/pci-host-generic.h
> @@ -1,5 +1,5 @@
> -#ifndef PCI_HOST_GENERIC_H
> -#define PCI_HOST_GENERIC_H
> +#ifndef _PCI_HOST_GENERIC_H_
> +#define _PCI_HOST_GENERIC_H_
>  /*
>   * PCI host bridge supporting structures and constants
>   *
> diff --git a/lib/setjmp.h b/lib/setjmp.h
> index 2c56b4c68aaa..6afdf665681a 100644
> --- a/lib/setjmp.h
> +++ b/lib/setjmp.h
> @@ -4,8 +4,8 @@
>   * This code is free software; you can redistribute it and/or modify it
>   * under the terms of the GNU Library General Public License version 2.
>   */
> -#ifndef LIBCFLAT_SETJMP_H
> -#define LIBCFLAT_SETJMP_H 1
> +#ifndef _LIBCFLAT_SETJMP_H_
> +#define _LIBCFLAT_SETJMP_H_
>  
>  typedef struct jmp_buf_tag {
>  	long int regs[8];
> diff --git a/lib/string.h b/lib/string.h
> index e1febfed7fb2..b07763eaef10 100644
> --- a/lib/string.h
> +++ b/lib/string.h
> @@ -4,8 +4,8 @@
>   * This code is free software; you can redistribute it and/or modify it
>   * under the terms of the GNU Library General Public License version 2.
>   */
> -#ifndef __STRING_H
> -#define __STRING_H
> +#ifndef _STRING_H_
> +#define _STRING_H_
>  
>  extern size_t strlen(const char *buf);
>  extern size_t strnlen(const char *buf, size_t maxlen);
> @@ -23,4 +23,4 @@ extern int memcmp(const void *s1, const void *s2, size_t n);
>  extern void *memmove(void *dest, const void *src, size_t n);
>  extern void *memchr(const void *s, int c, size_t n);
>  
> -#endif /* _STRING_H */
> +#endif /* _STRING_H_ */
> diff --git a/lib/vmalloc.h b/lib/vmalloc.h
> index 8b158f591d75..346f94f198c5 100644
> --- a/lib/vmalloc.h
> +++ b/lib/vmalloc.h
> @@ -1,5 +1,5 @@
> -#ifndef VMALLOC_H
> -#define VMALLOC_H 1
> +#ifndef _VMALLOC_H_
> +#define _VMALLOC_H_
>  
>  #include <asm/page.h>
>  
>
Cornelia Huck June 9, 2021, 3:37 p.m. UTC | #3
On Wed, Jun 09 2021, Laurent Vivier <lvivier@redhat.com> wrote:

> On 09/06/2021 16:37, Cornelia Huck wrote:
>> Standardize header guards to _LIB_HEADER_H_.
>> 
>> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
>> ---
>>  lib/alloc_page.h       | 4 ++--
>>  lib/libcflat.h         | 4 ++--
>>  lib/list.h             | 4 ++--
>>  lib/pci-edu.h          | 4 ++--
>>  lib/pci-host-generic.h | 4 ++--
>>  lib/setjmp.h           | 4 ++--
>>  lib/string.h           | 6 +++---
>>  lib/vmalloc.h          | 4 ++--
>>  8 files changed, 17 insertions(+), 17 deletions(-)
>
> What about lib/argv.h and lib/pci.h?

argv.h does not have a header guard yet (it probably should?)

I forgot to commit my changes to pci.h, I think :(

>
> And there is also this instance of CONFIG_H in lib/config.h generated
> by configure.

Yeah, we should tweak the generator for that.
Laurent Vivier June 9, 2021, 3:49 p.m. UTC | #4
On 09/06/2021 17:37, Cornelia Huck wrote:
> On Wed, Jun 09 2021, Laurent Vivier <lvivier@redhat.com> wrote:
> 
>> On 09/06/2021 16:37, Cornelia Huck wrote:
>>> Standardize header guards to _LIB_HEADER_H_.
>>>
>>> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
>>> ---
>>>  lib/alloc_page.h       | 4 ++--
>>>  lib/libcflat.h         | 4 ++--
>>>  lib/list.h             | 4 ++--
>>>  lib/pci-edu.h          | 4 ++--
>>>  lib/pci-host-generic.h | 4 ++--
>>>  lib/setjmp.h           | 4 ++--
>>>  lib/string.h           | 6 +++---
>>>  lib/vmalloc.h          | 4 ++--
>>>  8 files changed, 17 insertions(+), 17 deletions(-)
>>
>> What about lib/argv.h and lib/pci.h?
> 
> argv.h does not have a header guard yet (it probably should?)

I think if we want to standardize header guards we should add them where they are not.

But no real strong opinion on that...

Thanks,
Laurent
diff mbox series

Patch

diff --git a/lib/alloc_page.h b/lib/alloc_page.h
index 1af1419d49b6..eed2ba06eeaf 100644
--- a/lib/alloc_page.h
+++ b/lib/alloc_page.h
@@ -5,8 +5,8 @@ 
  * with byte granularity.
  */
 
-#ifndef ALLOC_PAGE_H
-#define ALLOC_PAGE_H 1
+#ifndef _ALLOC_PAGE_H_
+#define _ALLOC_PAGE_H_
 
 #include <stdbool.h>
 #include <asm/memory_areas.h>
diff --git a/lib/libcflat.h b/lib/libcflat.h
index 460a1234ea6a..f40b431d1550 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -17,8 +17,8 @@ 
  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  */
 
-#ifndef __LIBCFLAT_H
-#define __LIBCFLAT_H
+#ifndef _LIBCFLAT_H_
+#define _LIBCFLAT_H_
 
 #ifndef __ASSEMBLY__
 
diff --git a/lib/list.h b/lib/list.h
index 7f9717ef6258..ed3e52b40075 100644
--- a/lib/list.h
+++ b/lib/list.h
@@ -1,5 +1,5 @@ 
-#ifndef LIST_H
-#define LIST_H
+#ifndef _LIST_H_
+#define _LIST_H_
 
 #include <stdbool.h>
 
diff --git a/lib/pci-edu.h b/lib/pci-edu.h
index 44b4ba168768..9db94aec0bc7 100644
--- a/lib/pci-edu.h
+++ b/lib/pci-edu.h
@@ -12,8 +12,8 @@ 
  * Edu device is a virtualized device in QEMU. Please refer to
  * docs/specs/edu.txt in QEMU repository for EDU device manual.
  */
-#ifndef __PCI_EDU_H__
-#define __PCI_EDU_H__
+#ifndef _PCI_EDU_H_
+#define _PCI_EDU_H_
 
 #include "pci.h"
 #include "asm/io.h"
diff --git a/lib/pci-host-generic.h b/lib/pci-host-generic.h
index 0ffe6380ec8f..3020ee22c837 100644
--- a/lib/pci-host-generic.h
+++ b/lib/pci-host-generic.h
@@ -1,5 +1,5 @@ 
-#ifndef PCI_HOST_GENERIC_H
-#define PCI_HOST_GENERIC_H
+#ifndef _PCI_HOST_GENERIC_H_
+#define _PCI_HOST_GENERIC_H_
 /*
  * PCI host bridge supporting structures and constants
  *
diff --git a/lib/setjmp.h b/lib/setjmp.h
index 2c56b4c68aaa..6afdf665681a 100644
--- a/lib/setjmp.h
+++ b/lib/setjmp.h
@@ -4,8 +4,8 @@ 
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Library General Public License version 2.
  */
-#ifndef LIBCFLAT_SETJMP_H
-#define LIBCFLAT_SETJMP_H 1
+#ifndef _LIBCFLAT_SETJMP_H_
+#define _LIBCFLAT_SETJMP_H_
 
 typedef struct jmp_buf_tag {
 	long int regs[8];
diff --git a/lib/string.h b/lib/string.h
index e1febfed7fb2..b07763eaef10 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -4,8 +4,8 @@ 
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Library General Public License version 2.
  */
-#ifndef __STRING_H
-#define __STRING_H
+#ifndef _STRING_H_
+#define _STRING_H_
 
 extern size_t strlen(const char *buf);
 extern size_t strnlen(const char *buf, size_t maxlen);
@@ -23,4 +23,4 @@  extern int memcmp(const void *s1, const void *s2, size_t n);
 extern void *memmove(void *dest, const void *src, size_t n);
 extern void *memchr(const void *s, int c, size_t n);
 
-#endif /* _STRING_H */
+#endif /* _STRING_H_ */
diff --git a/lib/vmalloc.h b/lib/vmalloc.h
index 8b158f591d75..346f94f198c5 100644
--- a/lib/vmalloc.h
+++ b/lib/vmalloc.h
@@ -1,5 +1,5 @@ 
-#ifndef VMALLOC_H
-#define VMALLOC_H 1
+#ifndef _VMALLOC_H_
+#define _VMALLOC_H_
 
 #include <asm/page.h>