]> granicus.if.org Git - graphviz/commitdiff
API BREAK: remove unused '_DUMMY_ELEM'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 8 Jan 2022 02:01:11 +0000 (18:01 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 9 Jan 2022 23:51:57 +0000 (15:51 -0800)
ISO C99 and C++11 both permit trailing commas in enum members. Graphviz has been
compiled using C99 since fe3f9411d2c59b463ab1b64eecfd19f2db55d2fc and C++11
since a74e0e104e114bcf890eb8419a0bf02a22e01d84. This wart was not removed
previously as removing it was considered an API break not worth doing. The
upcoming release is projected to bump the major version number, making breaks
like this more acceptable.

CHANGELOG.md
lib/gvc/gvcext.h

index 105e76d3c182236999013ed09f25c19244559f54..3b9b02d2d43dd53e9f556d104b9584d794d72b7c 100644 (file)
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   drop-in replacement is `SHRT_MAX` in the C standard library’s limits.h.
 - **Breaking**: Graphviz headers no longer (re-)define the C constants `INT_MIN`
   and `INT_MAX`. Replacements can be found in the C standard library’s limits.h.
+- **Breaking**: Graphviz headers no longer define the constant `_DUMMY_ELEM`.
 - The Ming plugin that produced Shockwave files has been removed. This format
   was EOLed by Adobe in April 2019. #2160
 - CentOS 7 packages now include libmingle and the `mingle` program.
index 9a6b7761277f75c291eb98b6977c826340b614d4..7c2c4e3252d10522cdc45e148f5aa290e74ba74e 100644 (file)
@@ -27,25 +27,7 @@ extern "C" {
  * Define api_t using names based on the plugin names with API_ prefixed.
  */
 #define ELEM(x) API_##x,
-    typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */
-                       /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0"
-                        * is to avoid a "," after the last element of the enum
-                        * because some compilers when using "-pedantic"
-                        * generate an error for about the dangling ","
-                        * but only if this header is used from a .cpp file!
-                        * Setting it to 0 makes sure that the enumeration
-                        * does not define an extra value.  (It does however
-                        * define _DUMMY_ELEM_ as an enumeration symbol,
-                        * but its value duplicates that of the first
-                        * symbol in the enumeration - in this case "render".)
-                        */
-
-                       /* One could wonder why trailing "," in:
-                        *      int nums[]={1,2,3,};
-                        * is OK, but in:
-                        *      typedef enum {a,b,c,} abc_t; 
-                        * is not!!!
-                        */
+    typedef enum { APIS } api_t; /* API_render, API_layout, ... */
 #undef ELEM
 
     typedef struct GVJ_s GVJ_t;