[Mesa-dev] [PATCH] radv: Use proper header guards over 'pragma once' directives
Eric Engestrom
eric.engestrom at imgtec.com
Fri Oct 7 12:31:26 UTC 2016
On Fri, Oct 07, 2016 at 10:21:34PM +1100, Edward O'Callaghan wrote:
> Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
I thought we decided `#pragma once` was good enough for most situations
so we weren't going to change them to proper include guards?
Regardless, this is is (marginally) better and looks good to me, so:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> src/amd/vulkan/radv_cs.h | 6 +++++-
> src/amd/vulkan/radv_descriptor_set.h | 8 ++++++--
> src/amd/vulkan/radv_device_info.h | 6 +++++-
> src/amd/vulkan/radv_meta.h | 5 ++++-
> src/amd/vulkan/radv_private.h | 4 +++-
> src/amd/vulkan/radv_radeon_winsys.h | 5 ++++-
> src/amd/vulkan/radv_util.h | 4 +++-
> src/amd/vulkan/radv_wsi.h | 5 ++++-
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h | 7 ++++++-
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.h | 6 +++++-
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.h | 6 +++++-
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h | 6 +++++-
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h | 6 +++++-
> 13 files changed, 60 insertions(+), 14 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cs.h b/src/amd/vulkan/radv_cs.h
> index 6481df1..2c8935f 100644
> --- a/src/amd/vulkan/radv_cs.h
> +++ b/src/amd/vulkan/radv_cs.h
> @@ -21,7 +21,9 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_CS_H
> +#define RADV_CS_H
>
> #include <string.h>
> #include <stdint.h>
> @@ -115,3 +117,5 @@ static inline void radeon_set_uconfig_reg_idx(struct radeon_winsys_cs *cs,
> radeon_emit(cs, (reg - CIK_UCONFIG_REG_OFFSET) >> 2 | (idx << 28));
> radeon_emit(cs, value);
> }
> +
> +#endif /* RADV_CS_H */
> diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h
> index cad1ccf..0674822 100644
> --- a/src/amd/vulkan/radv_descriptor_set.h
> +++ b/src/amd/vulkan/radv_descriptor_set.h
> @@ -1,6 +1,6 @@
> /*
> * Copyright © 2016 Bas Nieuwenhuizen
> - *
> + *
> * Permission is hereby granted, free of charge, to any person obtaining a
> * copy of this software and associated documentation files (the "Software"),
> * to deal in the Software without restriction, including without limitation
> @@ -20,7 +20,9 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_DESCRIPTOR_SET_H
> +#define RADV_DESCRIPTOR_SET_H
>
> #include <vulkan/vulkan.h>
>
> @@ -79,3 +81,5 @@ struct radv_pipeline_layout {
>
> unsigned char sha1[20];
> };
> +
> +#endif /* RADV_DESCRIPTOR_SET_H */
> diff --git a/src/amd/vulkan/radv_device_info.h b/src/amd/vulkan/radv_device_info.h
> index c38bd2a..81cb321 100644
> --- a/src/amd/vulkan/radv_device_info.h
> +++ b/src/amd/vulkan/radv_device_info.h
> @@ -21,12 +21,16 @@
> * IN THE SOFTWARE.
> */
>
> -#pragma once
> +#ifndef RADV_DEVICE_INFO_H
> +#define RADV_DEVICE_INFO_H
>
> #include <amdgpu.h>
>
> #include "radv_radeon_winsys.h"
> +
> struct radv_device_info {
> uint32_t pci_id;
> enum chip_class chip_class;
> };
> +
> +#endif /* RADV_DEVICE_INFO_H */
> diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
> index ae63a30..97d020c 100644
> --- a/src/amd/vulkan/radv_meta.h
> +++ b/src/amd/vulkan/radv_meta.h
> @@ -23,7 +23,8 @@
> * IN THE SOFTWARE.
> */
>
> -#pragma once
> +#ifndef RADV_META_H
> +#define RADV_META_H
>
> #include "radv_private.h"
>
> @@ -188,3 +189,5 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
> #ifdef __cplusplus
> }
> #endif
> +
> +#endif /* RADV_META_H */
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index e738218..b69ffd1 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -25,7 +25,8 @@
> * IN THE SOFTWARE.
> */
>
> -#pragma once
> +#ifndef RADV_PRIVATE_H
> +#define RADV_PRIVATE_H
>
> #include <stdlib.h>
> #include <stdio.h>
> @@ -1400,3 +1401,4 @@ RADV_DEFINE_STRUCT_CASTS(radv_common, VkBufferMemoryBarrier)
> RADV_DEFINE_STRUCT_CASTS(radv_common, VkImageMemoryBarrier)
>
>
> +#endif /* RADV_PRIVATE_H */
> diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
> index 29a4ee3..6370f3d 100644
> --- a/src/amd/vulkan/radv_radeon_winsys.h
> +++ b/src/amd/vulkan/radv_radeon_winsys.h
> @@ -25,7 +25,9 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_RADEON_WINSYS_H
> +#define RADV_RADEON_WINSYS_H
>
> #include <stdint.h>
> #include <stdbool.h>
> @@ -334,3 +336,4 @@ static inline void radeon_emit_array(struct radeon_winsys_cs *cs,
> cs->cdw += count;
> }
>
> +#endif /* RADV_RADEON_WINSYS_H */
> diff --git a/src/amd/vulkan/radv_util.h b/src/amd/vulkan/radv_util.h
> index 57a4c95..2b00488 100644
> --- a/src/amd/vulkan/radv_util.h
> +++ b/src/amd/vulkan/radv_util.h
> @@ -1,4 +1,5 @@
> -#pragma once
> +#ifndef RADV_UTIL_H
> +#define RADV_UTIL_H
>
> #ifdef HAVE___BUILTIN_POPCOUNT
> #define util_bitcount(i) __builtin_popcount(i)
> @@ -7,3 +8,4 @@ extern unsigned int
> util_bitcount(unsigned int n);
> #endif
>
> +#endif /* RADV_UTIL_H */
> diff --git a/src/amd/vulkan/radv_wsi.h b/src/amd/vulkan/radv_wsi.h
> index 3e453fb..d624ab2 100644
> --- a/src/amd/vulkan/radv_wsi.h
> +++ b/src/amd/vulkan/radv_wsi.h
> @@ -23,7 +23,8 @@
> * IN THE SOFTWARE.
> */
>
> -#pragma once
> +#ifndef RADV_WSI_H
> +#define RADV_WSI_H
>
> #include "radv_private.h"
>
> @@ -77,3 +78,5 @@ VkResult radv_x11_init_wsi(struct radv_physical_device *physical_device);
> void radv_x11_finish_wsi(struct radv_physical_device *physical_device);
> VkResult radv_wl_init_wsi(struct radv_physical_device *physical_device);
> void radv_wl_finish_wsi(struct radv_physical_device *physical_device);
> +
> +#endif /* RADV_WSI_H */
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
> index 59a1bb7..499b063 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
> @@ -25,8 +25,12 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_AMDGPU_BO_H
> +#define RADV_AMDGPU_BO_H
> +
> #include "radv_amdgpu_winsys.h"
> +
> struct radv_amdgpu_winsys_bo {
> amdgpu_bo_handle bo;
> amdgpu_va_handle va_handle;
> @@ -48,3 +52,4 @@ struct radv_amdgpu_winsys_bo *radv_amdgpu_winsys_bo(struct radeon_winsys_bo *bo)
>
> void radv_amdgpu_bo_init_functions(struct radv_amdgpu_winsys *ws);
>
> +#endif /* RADV_AMDGPU_BO_H */
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.h
> index 230639a..b4482fc 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.h
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.h
> @@ -25,7 +25,9 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_AMDGPU_CS_H
> +#define RADV_AMDGPU_CS_H
>
> #include <string.h>
> #include <stdint.h>
> @@ -49,3 +51,5 @@ radv_amdgpu_ctx(struct radeon_winsys_ctx *base)
> }
>
> void radv_amdgpu_cs_init_functions(struct radv_amdgpu_winsys *ws);
> +
> +#endif /* RADV_AMDGPU_CS_H */
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.h
> index acc12af..cdc8c81 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.h
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.h
> @@ -21,9 +21,13 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_AMDGPU_SURFACE_H
> +#define RADV_AMDGPU_SURFACE_H
>
> #include <amdgpu.h>
>
> void radv_amdgpu_surface_init_functions(struct radv_amdgpu_winsys *ws);
> ADDR_HANDLE radv_amdgpu_addr_create(struct amdgpu_gpu_info *amdinfo, int family, int rev_id, enum chip_class chip_class);
> +
> +#endif /* RADV_AMDGPU_SURFACE_H */
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
> index b79495d..abb238b 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
> @@ -24,7 +24,9 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_AMDGPU_WINSYS_H
> +#define RADV_AMDGPU_WINSYS_H
>
> #include "radv_radeon_winsys.h"
> #include "addrlib/addrinterface.h"
> @@ -55,3 +57,5 @@ radv_amdgpu_winsys(struct radeon_winsys *base)
> {
> return (struct radv_amdgpu_winsys*)base;
> }
> +
> +#endif /* RADV_AMDGPU_WINSYS_H */
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
> index cf06601..208561d 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
> @@ -25,6 +25,10 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> -#pragma once
> +
> +#ifndef RADV_AMDGPU_WINSYS_PUBLIC_H
> +#define RADV_AMDGPU_WINSYS_PUBLIC_H
>
> struct radeon_winsys *radv_amdgpu_winsys_create(int fd);
> +
> +#endif /* RADV_AMDGPU_WINSYS_PUBLIC_H */
> --
> 2.7.4
More information about the mesa-dev
mailing list