From eff75b630f63afd558d5efbdfe177f91f9732ff0 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Thu, 1 Jul 2021 18:28:41 -0400 Subject: [PATCH] Get rid of anonymous struct typedefs We are using C++14 where there is no reason for this and is banned in C++20 under P1766R1. MSVC generates a warning under C++14 as a reminder. --- .../3d_render_raytracing/shapes2D/polygon_2d.h | 16 ++++++++-------- 3d-viewer/3d_rendering/image.h | 4 ++-- eeschema/sch_plugins/eagle/sch_eagle_plugin.h | 8 ++++---- include/asset_archive.h | 4 ++-- include/gal/cairo/cairo_compositor.h | 4 ++-- include/gal/cairo/cairo_gal.h | 4 ++-- include/gal/opengl/opengl_compositor.h | 4 ++-- include/gal/opengl/opengl_gal.h | 4 ++-- include/plugins/3dapi/c3dmodel.h | 12 ++++++------ libs/kimath/include/geometry/shape_poly_set.h | 4 ++-- pcbnew/plugins/kicad/pcb_parser.h | 4 ++-- pcbnew/plugins/pcad/pcad2kicad_common.h | 4 ++-- pcbnew/plugins/pcad/pcb_callbacks.h | 4 ++-- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/polygon_2d.h b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/polygon_2d.h index a176292d9b..8132dbf991 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/polygon_2d.h +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/polygon_2d.h @@ -35,27 +35,27 @@ #include -typedef struct +struct POLYSEGMENT { SFVEC2F m_Start; float m_inv_JY_minus_IY = 0.0; float m_JX_minus_IX = 0.0; -} POLYSEGMENT; +}; -typedef struct +struct SEG_NORMALS { SFVEC2F m_Start; SFVEC2F m_End; -} SEG_NORMALS; +}; -typedef struct +struct SEGMENT_WITH_NORMALS { SFVEC2F m_Start; SFVEC2F m_Precalc_slope; SEG_NORMALS m_Normals; -} SEGMENT_WITH_NORMALS; +}; typedef std::vector< POLYSEGMENT > SEGMENTS; @@ -75,11 +75,11 @@ typedef std::vector< SEGMENT_WITH_NORMALS > SEGMENTS_WIDTH_NORMALS; * It can contain multiple closed polygons and holes and us used to test if points are inside. * A point will be inside the polygon if it is not inside a hole and it is inside an outer polygon. */ -typedef struct +struct OUTERS_AND_HOLES { std::vector m_Outers; std::vector m_Holes; -} OUTERS_AND_HOLES; +}; /** diff --git a/3d-viewer/3d_rendering/image.h b/3d-viewer/3d_rendering/image.h index 79ae04b81f..aa7bb2704f 100644 --- a/3d-viewer/3d_rendering/image.h +++ b/3d-viewer/3d_rendering/image.h @@ -75,12 +75,12 @@ enum class IMAGE_FILTER }; /// 5x5 Filter struct parameters -typedef struct +struct S_FILTER { signed char kernel[5][5]; unsigned int div; unsigned char offset; -} S_FILTER; +}; /** diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h index 5953d90065..1c4ec6cb48 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h @@ -60,14 +60,14 @@ class LIB_TEXT; class wxXmlNode; -typedef struct EAGLE_LIBRARY +struct EAGLE_LIBRARY { wxString name; boost::ptr_map KiCadSymbols; std::unordered_map SymbolNodes; std::unordered_map GateUnit; std::unordered_map package; -} EAGLE_LIBRARY; +}; typedef boost::ptr_map EPART_LIST; @@ -250,14 +250,14 @@ private: std::vector m_wireIntersections; ///< Wires and labels of a single connection (segment in Eagle nomenclature) - typedef struct SEG_DESC_STRUCT + struct SEG_DESC { ///< Test if a particular label is attached to any of the stored segments const SEG* LabelAttached( const SCH_TEXT* aLabel ) const; std::vector labels; std::vector segs; - } SEG_DESC; + }; ///< Segments representing wires for intersection checking std::vector m_segments; diff --git a/include/asset_archive.h b/include/asset_archive.h index 56961c5a51..69b9a3da7f 100644 --- a/include/asset_archive.h +++ b/include/asset_archive.h @@ -59,11 +59,11 @@ public: long GetFilePointer( const wxString& aFilePath, const unsigned char** aDest ); private: - typedef struct + struct FILE_INFO { size_t offset; size_t length; - } FILE_INFO; + }; /// Cache of file info for a given file path std::unordered_map m_fileInfoCache; diff --git a/include/gal/cairo/cairo_compositor.h b/include/gal/cairo/cairo_compositor.h index 105b18468b..9a0dc71ff8 100644 --- a/include/gal/cairo/cairo_compositor.h +++ b/include/gal/cairo/cairo_compositor.h @@ -118,12 +118,12 @@ protected: } typedef uint32_t* BitmapPtr; - typedef struct + struct CAIRO_BUFFER { cairo_t* context; ///< Main texture handle cairo_surface_t* surface; ///< Point to which an image from texture is attached BitmapPtr bitmap; ///< Pixel storage - } CAIRO_BUFFER; + }; unsigned int m_current; ///< Currently used buffer handle typedef std::deque CAIRO_BUFFERS; diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h index 00033ff705..e85a22c6d5 100644 --- a/include/gal/cairo/cairo_gal.h +++ b/include/gal/cairo/cairo_gal.h @@ -310,7 +310,7 @@ protected: }; /// Type definition for an graphics group element - typedef struct + struct GROUP_ELEMENT { GRAPHICS_COMMAND m_Command; ///< Command to execute union { @@ -319,7 +319,7 @@ protected: int IntArg = 0; ///< An int argument } m_Argument; cairo_path_t* m_CairoPath = nullptr; ///< Pointer to a Cairo path - } GROUP_ELEMENT; + }; typedef std::deque GROUP; ///< A graphic group type definition diff --git a/include/gal/opengl/opengl_compositor.h b/include/gal/opengl/opengl_compositor.h index ae295cedc2..0d6ac7c342 100644 --- a/include/gal/opengl/opengl_compositor.h +++ b/include/gal/opengl/opengl_compositor.h @@ -112,12 +112,12 @@ protected: } // Buffers are simply textures storing a result of certain target rendering. - typedef struct + struct OPENGL_BUFFER { VECTOR2U dimensions; GLuint textureTarget; ///< Main texture handle GLuint attachmentPoint; ///< Point to which an image from texture is attached - } OPENGL_BUFFER; + }; bool m_initialized; ///< Initialization status flag unsigned int m_curBuffer; ///< Currently used buffer handle diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index 93262a3f2b..17d335d0bd 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -279,14 +279,14 @@ public: } ///< Parameters passed to the GLU tesselator - typedef struct + struct TessParams { /// Manager used for storing new vertices VERTEX_MANAGER* vboManager; /// Intersect points, that have to be freed after tessellation std::deque< boost::shared_array >& intersectPoints; - } TessParams; + }; private: /// Super class definition diff --git a/include/plugins/3dapi/c3dmodel.h b/include/plugins/3dapi/c3dmodel.h index 065ce89498..52abab4c65 100644 --- a/include/plugins/3dapi/c3dmodel.h +++ b/include/plugins/3dapi/c3dmodel.h @@ -34,7 +34,7 @@ #include "plugins/3dapi/xv3d_types.h" -typedef struct +struct SMATERIAL { SFVEC3F m_Ambient; // SFVEC3F m_Diffuse; ///< Default diffuse color if m_Color is NULL @@ -54,7 +54,7 @@ typedef struct wxString m_Displacement; // disp wxString m_Alpha; // map_d };*/ -} SMATERIAL; +}; /// Per-vertex normal/color/texcoors structure. @@ -73,7 +73,7 @@ typedef struct /// To convert this units to pcbunits, use the conversion facto UNITS3D_TO_UNITSPCB /// /// m_Normals, m_Color and m_Texcoords are between 0.0f and 1.0f -typedef struct +struct SMESH { unsigned int m_VertexSize; ///< Number of vertex in the arrays SFVEC3F *m_Positions; ///< Vertex position array @@ -83,17 +83,17 @@ typedef struct unsigned int m_FaceIdxSize; ///< Number of elements of the m_FaceIdx array unsigned int *m_FaceIdx; ///< Triangle Face Indexes unsigned int m_MaterialIdx; ///< Material Index to be used in this mesh (must be < m_MaterialsSize ) -} SMESH; +}; /// Store the a model based on meshes and materials -typedef struct +struct S3DMODEL { unsigned int m_MeshesSize; ///< Number of meshes in the array SMESH *m_Meshes; ///< The meshes list of this model unsigned int m_MaterialsSize; ///< Number of materials in the material array SMATERIAL *m_Materials; ///< The materials list of this model -} S3DMODEL; +}; #endif // C3DMODEL_H diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index e1ff654d0d..2bb3c970e4 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -183,7 +183,7 @@ public: * SHAPE_POLY_SET object: the polygon index, the contour index relative to the polygon and * the vertex index relative the contour. */ - typedef struct VERTEX_INDEX + struct VERTEX_INDEX { int m_polygon; /*!< m_polygon is the index of the polygon. */ int m_contour; /*!< m_contour is the index of the contour relative to the polygon. */ @@ -195,7 +195,7 @@ public: m_vertex(-1) { } - } VERTEX_INDEX; + }; /** * Base class for iterating over all vertices in a given SHAPE_POLY_SET. diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 9fa9527203..6f8091710c 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -367,13 +367,13 @@ private: // We don't want to rely on group declarations being last in the file, so // we store info about the group declarations here during parsing and then resolve // them into BOARD_ITEM* after we've parsed the rest of the file. - typedef struct + struct GROUP_INFO { BOARD_ITEM* parent; wxString name; KIID uuid; std::vector memberUuids; - } GROUP_INFO; + }; std::vector m_groupInfos; }; diff --git a/pcbnew/plugins/pcad/pcad2kicad_common.h b/pcbnew/plugins/pcad/pcad2kicad_common.h index 7c982ab8b7..31786e2bfb 100644 --- a/pcbnew/plugins/pcad/pcad2kicad_common.h +++ b/pcbnew/plugins/pcad/pcad2kicad_common.h @@ -53,7 +53,7 @@ enum TTEXT_JUSTIFY Right }; -typedef struct _TTEXTVALUE +struct TTEXTVALUE { wxString text; int textPositionX, textPositionY, @@ -64,7 +64,7 @@ typedef struct _TTEXTVALUE bool isBold; bool isItalic; bool isTrueType; -} TTEXTVALUE; +}; extern wxString GetWord( wxString* aStr ); extern XNODE* FindPinMap( XNODE* aNode ); diff --git a/pcbnew/plugins/pcad/pcb_callbacks.h b/pcbnew/plugins/pcad/pcb_callbacks.h index 9532eb7d9b..845a2ad55d 100644 --- a/pcbnew/plugins/pcad/pcb_callbacks.h +++ b/pcbnew/plugins/pcad/pcb_callbacks.h @@ -41,12 +41,12 @@ enum LAYER_TYPE_T LAYER_TYPE_PLANE }; -typedef struct _TLAYER +struct TLAYER { PCB_LAYER_ID KiCadLayer; LAYER_TYPE_T layerType; wxString netNameRef; -} TLAYER; +}; namespace PCAD2KICAD {