From: Matthew Fernandez Date: Sat, 8 Jan 2022 02:01:11 +0000 (-0800) Subject: API BREAK: remove unused '_DUMMY_ELEM' X-Git-Tag: 3.0.0~83^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89e046de9517c4b4d91f0c9dfe6e5a6b2a1ac99d;p=graphviz API BREAK: remove unused '_DUMMY_ELEM' 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. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 105e76d3c..3b9b02d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/gvc/gvcext.h b/lib/gvc/gvcext.h index 9a6b77612..7c2c4e325 100644 --- a/lib/gvc/gvcext.h +++ b/lib/gvc/gvcext.h @@ -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;