diff options
author | Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp> | 2019-06-15 16:00:54 +0900 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2019-08-09 11:54:54 -0700 |
commit | 7a79fa361e51857a8335b28fbea066abf9984a61 (patch) | |
tree | 875dab835ac75abed1fcb5da3c7f7991c0d275ad /libparted | |
parent | f1591110ec071c8b88420dea8ad50c779f64a681 (diff) | |
download | parted-7a79fa361e51857a8335b28fbea066abf9984a61.tar.gz |
libparted/labels/pt-tools.c: Fix gperf generated function attribute
GCC 8 fails to compile libparted/labels/pt-tools.c with an error:
CC pt-tools.lo
In file included from pt-tools.c:114:
pt-tools.c: In function 'pt_limit_lookup':
pt-limit.gperf:78:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure]
cc1: all warnings being treated as errors
"Pure" attribute is required for the function pt_limit_lookup() because
it does not change program status other than its return value.
To avoid the build failure, add _GL_ATTRIBUTE_PURE to the function.
The attribute cannot be added in libparted/gperf/pt-limit.c because it
is generated by gperf during the build process. Instead, add the
attribute in libparted/gperf/pt-tools.c which includes the generated
function.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
Diffstat (limited to 'libparted')
-rw-r--r-- | libparted/labels/pt-tools.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libparted/labels/pt-tools.c b/libparted/labels/pt-tools.c index 8100f32..88703d3 100644 --- a/libparted/labels/pt-tools.c +++ b/libparted/labels/pt-tools.c @@ -111,6 +111,7 @@ ptt_geom_clear_sectors (PedGeometry *geom, PedSector start, PedSector n) return ptt_clear_sectors (geom->dev, geom->start + start, n); } +#define pt_limit_lookup _GL_ATTRIBUTE_PURE __pt_limit_lookup #include "pt-limit.c" /* Throw an exception and return 0 if PART's starting sector number or @@ -120,7 +121,7 @@ int ptt_partition_max_start_len (char const *pt_type, const PedPartition *part) { struct partition_limit const *pt_lim - = pt_limit_lookup (pt_type, strlen (pt_type)); + = __pt_limit_lookup (pt_type, strlen (pt_type)); /* If we don't have info on the type, return "true". */ if (pt_lim == NULL) @@ -162,7 +163,7 @@ int ptt_partition_max_start_sector (char const *pt_type, PedSector *max) { struct partition_limit const *pt_lim - = pt_limit_lookup (pt_type, strlen (pt_type)); + = __pt_limit_lookup (pt_type, strlen (pt_type)); if (pt_lim == NULL) return -1; @@ -176,7 +177,7 @@ int ptt_partition_max_length (char const *pt_type, PedSector *max) { struct partition_limit const *pt_lim - = pt_limit_lookup (pt_type, strlen (pt_type)); + = __pt_limit_lookup (pt_type, strlen (pt_type)); if (pt_lim == NULL) return -1; |