[Bf-blender-cvs] [fea1026bb8e] master: Cleanup: use 'pragma once'

Campbell Barton noreply at git.blender.org
Mon Jan 4 07:41:51 CET 2021


Commit: fea1026bb8e2b5bfdf247491658c384805b51813
Author: Campbell Barton
Date:   Mon Jan 4 13:10:22 2021 +1100
Branches: master
https://developer.blender.org/rBfea1026bb8e2b5bfdf247491658c384805b51813

Cleanup: use 'pragma once'

Add explanations for cases the header-guard defines are still used.

===================================================================

M	source/blender/blenkernel/BKE_asset.h
M	source/blender/blenlib/BLI_endian_switch.h
M	source/blender/blenlib/BLI_memory_utils.h
M	source/blender/blenlib/BLI_task.h
M	source/blender/blenlib/BLI_utildefines.h
M	source/blender/blenlib/tests/BLI_ressource_strings.h
M	source/blender/blenloader/tests/blendfile_loading_base_test.h
M	source/blender/compositor/nodes/COM_ColorExposureNode.h
M	source/blender/compositor/operations/COM_ColorExposureOperation.h
M	source/blender/editors/geometry/geometry_intern.h
M	source/blender/editors/gpencil/gpencil_trace.h
M	source/blender/editors/include/ED_asset.h
M	source/blender/editors/include/ED_geometry.h
M	source/blender/makesdna/DNA_asset_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_types.h
M	source/blender/python/generic/py_capi_utils.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_asset.h b/source/blender/blenkernel/BKE_asset.h
index 38cd5747343..d1f543b1f38 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -14,13 +14,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef __BKE_ASSET_H__
-#define __BKE_ASSET_H__
-
 /** \file
  * \ingroup bke
  */
 
+#pragma once
+
 #include "BLI_utildefines.h"
 
 #ifdef __cplusplus
@@ -55,5 +54,3 @@ void BKE_asset_metadata_read(struct BlendDataReader *reader, struct AssetMetaDat
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* __BKE_ASSET_H__ */
diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h
index c67c098053d..b512133b34c 100644
--- a/source/blender/blenlib/BLI_endian_switch.h
+++ b/source/blender/blenlib/BLI_endian_switch.h
@@ -14,6 +14,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/* Use a define instead of `#pragma once` because of `BLI_endian_switch_inline.h` */
 #ifndef __BLI_ENDIAN_SWITCH_H__
 #define __BLI_ENDIAN_SWITCH_H__
 
diff --git a/source/blender/blenlib/BLI_memory_utils.h b/source/blender/blenlib/BLI_memory_utils.h
index 99ec44cf9ea..79e25e26040 100644
--- a/source/blender/blenlib/BLI_memory_utils.h
+++ b/source/blender/blenlib/BLI_memory_utils.h
@@ -14,6 +14,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/* Use a define instead of `#pragma once` because of `BLI_utildefines.h` */
 #ifndef __BLI_MEMORY_UTILS_H__
 #define __BLI_MEMORY_UTILS_H__
 
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index 838993583a2..a3805f71316 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -14,6 +14,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/* Use a define instead of `#pragma once` because of `bmesh_iterators_inline.h` */
 #ifndef __BLI_TASK_H__
 #define __BLI_TASK_H__
 
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 40d24f07c25..1c6e6ffe578 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -17,6 +17,7 @@
  * All rights reserved.
  */
 
+/* Use a define instead of `#pragma once` because of `BLI_memory_utils.h` */
 #ifndef __BLI_UTILDEFINES_H__
 #define __BLI_UTILDEFINES_H__
 
diff --git a/source/blender/blenlib/tests/BLI_ressource_strings.h b/source/blender/blenlib/tests/BLI_ressource_strings.h
index 119aaeb0036..b685097eb48 100644
--- a/source/blender/blenlib/tests/BLI_ressource_strings.h
+++ b/source/blender/blenlib/tests/BLI_ressource_strings.h
@@ -1,7 +1,6 @@
 /* Apache License, Version 2.0 */
 
-#ifndef __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__
-#define __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__
+#pragma once
 
 /* Data file, don't format. */
 /* clang-format off */
@@ -606,5 +605,3 @@ const char words10k[] =
 ;
 
 /* clang-format on */
-
-#endif /* __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ */
diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.h b/source/blender/blenloader/tests/blendfile_loading_base_test.h
index f90e07218fb..32bb2959dcc 100644
--- a/source/blender/blenloader/tests/blendfile_loading_base_test.h
+++ b/source/blender/blenloader/tests/blendfile_loading_base_test.h
@@ -15,8 +15,8 @@
  *
  * The Original Code is Copyright (C) 2019 by Blender Foundation.
  */
-#ifndef __BLENDFILE_LOADING_BASE_TEST_H__
-#define __BLENDFILE_LOADING_BASE_TEST_H__
+
+#pragma once
 
 #include "DEG_depsgraph.h"
 #include "testing/testing.h"
@@ -60,5 +60,3 @@ class BlendfileLoadingBaseTest : public testing::Test {
   /* Free the depsgraph if it's not nullptr. */
   virtual void depsgraph_free();
 };
-
-#endif /* __BLENDFILE_LOADING_BASE_TEST_H__ */
diff --git a/source/blender/compositor/nodes/COM_ColorExposureNode.h b/source/blender/compositor/nodes/COM_ColorExposureNode.h
index 18aefb7eae4..c17e798b979 100644
--- a/source/blender/compositor/nodes/COM_ColorExposureNode.h
+++ b/source/blender/compositor/nodes/COM_ColorExposureNode.h
@@ -16,8 +16,7 @@
  * Copyright 2020, Blender Foundation.
  */
 
-#ifndef __COM_EXPOSURENODE_H__
-#define __COM_EXPOSURENODE_H__
+#pragma once
 
 #include "COM_Node.h"
 
@@ -30,5 +29,3 @@ class ExposureNode : public Node {
   ExposureNode(bNode *editorNode);
   void convertToOperations(NodeConverter &converter, const CompositorContext &context) const;
 };
-
-#endif
diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.h b/source/blender/compositor/operations/COM_ColorExposureOperation.h
index a65d5acbe6c..2b5f20f28f0 100644
--- a/source/blender/compositor/operations/COM_ColorExposureOperation.h
+++ b/source/blender/compositor/operations/COM_ColorExposureOperation.h
@@ -16,8 +16,8 @@
  * Copyright 2020, Blender Foundation.
  */
 
-#ifndef __COM_COLOREXPOSUREOPERATION_H__
-#define __COM_COLOREXPOSUREOPERATION_H__
+#pragma once
+
 #include "COM_NodeOperation.h"
 
 class ExposureOperation : public NodeOperation {
@@ -46,4 +46,3 @@ class ExposureOperation : public NodeOperation {
    */
   void deinitExecution();
 };
-#endif
diff --git a/source/blender/editors/geometry/geometry_intern.h b/source/blender/editors/geometry/geometry_intern.h
index 7c037fea18a..8a0f9294722 100644
--- a/source/blender/editors/geometry/geometry_intern.h
+++ b/source/blender/editors/geometry/geometry_intern.h
@@ -21,13 +21,10 @@
  * \ingroup edgeometry
  */
 
-#ifndef __GEOMETRY_INTERN_H__
-#define __GEOMETRY_INTERN_H__
+#pragma once
 
 struct wmOperatorType;
 
 /* *** geometry_attributes.c *** */
 void GEOMETRY_OT_attribute_add(struct wmOperatorType *ot);
 void GEOMETRY_OT_attribute_remove(struct wmOperatorType *ot);
-
-#endif /* __GEOMETRY_INTERN_H__ */
diff --git a/source/blender/editors/gpencil/gpencil_trace.h b/source/blender/editors/gpencil/gpencil_trace.h
index 85eb4e0609f..25d8dac2734 100644
--- a/source/blender/editors/gpencil/gpencil_trace.h
+++ b/source/blender/editors/gpencil/gpencil_trace.h
@@ -21,8 +21,7 @@
  * \ingroup edgpencil
  */
 
-#ifndef __GPENCIL_TRACE_H__
-#define __GPENCIL_TRACE_H__
+#pragma once
 
 /* internal exports only */
 struct FILE;
@@ -79,5 +78,3 @@ void ED_gpencil_trace_data_to_strokes(struct Main *bmain,
                                       const float sample,
                                       const int32_t resolution,
                                       const int32_t thickness);
-
-#endif /* __GPENCIL_TRACE_H__ */
diff --git a/source/blender/editors/include/ED_asset.h b/source/blender/editors/include/ED_asset.h
index 6fe50528cc5..dd505167fe5 100644
--- a/source/blender/editors/include/ED_asset.h
+++ b/source/blender/editors/include/ED_asset.h
@@ -18,8 +18,7 @@
  * \ingroup editors
  */
 
-#ifndef __ED_ASSET_H__
-#define __ED_ASSET_H__
+#pragma once
 
 #ifdef __cplusplus
 extern "C" {
@@ -35,5 +34,3 @@ void ED_operatortypes_asset(void);
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* __ED_ASSET_H__ */
diff --git a/source/blender/editors/include/ED_geometry.h b/source/blender/editors/include/ED_geometry.h
index 53eeba39088..d74fd15aaa7 100644
--- a/source/blender/editors/include/ED_geometry.h
+++ b/source/blender/editors/include/ED_geometry.h
@@ -21,8 +21,7 @@
  * \ingroup editors
  */
 
-#ifndef __ED_GEOMETRY_H__
-#define __ED_GEOMETRY_H__
+#pragma once
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,5 +32,3 @@ void ED_operatortypes_geometry(void);
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* __ED_GEOMETRY_H__ */
diff --git a/source/blender/makesdna/DNA_asset_types.h b/source/blender/makesdna/DNA_asset_types.h
index 671012e54ef..697d25653f8 100644
--- a/source/blender/makesdna/DNA_asset_types.h
+++ b/source/blender/makesdna/DNA_asset_types.h
@@ -18,11 +18,14 @@
  * \ingroup DNA
  */
 
-#ifndef __DNA_ASSET_TYPES_H__
-#define __DNA_ASSET_TYPES_H__
+#pragma once
 
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * \brief User defined tag.
  * Currently only used by assets, could be used more often at some point.
@@ -59,4 +62,6 @@ typedef struct AssetMetaData {
   char _pad[4];
 } AssetMetaData;
 
-#endif /* __DNA_ASSET_TYPES_H__ */
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 2d2e8d1a686..6a018ab270e 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -14,6 +14,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/* Use a define instead of `#pragma once` because of `rna_internal.h` */
 #ifndef __RNA_ACCESS_H__
 #define __RNA_ACCESS_H__
 
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 110497cd0a4..c4f6707dad5 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -18,6 +18,7 @@
  * \ingroup RNA
  */
 
+/* Use a define instead of `#pragma once` because of `BKE_addon.h`, `ED_object.h` & others. */
 #ifndef __RNA_TYPES_H__
 #define __RNA_TYPES_H__
 
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index e8b2e8ff502..f0875b82c3c 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -18,6 +18,7 @@
  * \ingroup pygen
  */
 
+/* Use a define instead of `#pragma once` because of `bmesh_py_types.h` */
 #ifndef __PY_CAPI_UTILS_H__
 #define __PY_CAPI_UTILS_H__



More information about the Bf-blender-cvs mailing list