[parted-devel] [PATCH 1/2] ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure'

dann frazier dann.frazier at canonical.com
Fri Aug 31 16:28:27 BST 2018


The const and pure attributes conflict:

  error: ignoring attribute 'const' because it conflicts with attribute 'pure' [-Werror=attributes]

pure functions may access global memory, const functions may not.
ped_unit_get_name() accesses non-local variable unit_names, so drop const.
---
 include/parted/unit.in.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/parted/unit.in.h b/include/parted/unit.in.h
index 9d6e06a0..315660de 100644
--- a/include/parted/unit.in.h
+++ b/include/parted/unit.in.h
@@ -66,7 +66,7 @@ typedef enum {
 
 extern long long ped_unit_get_size (const PedDevice* dev, PedUnit unit);
 extern const char *ped_unit_get_name (PedUnit unit)
-  _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_CONST;
+  _GL_ATTRIBUTE_PURE;
 extern PedUnit ped_unit_get_by_name (const char* unit_name) _GL_ATTRIBUTE_PURE;
 
 extern void ped_unit_set_default (PedUnit unit);
-- 
2.19.0.rc1




More information about the parted-devel mailing list