summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2021-08-10 09:40:28 -0700
committerBrian C. Lane <bcl@redhat.com>2021-08-10 09:40:28 -0700
commitfabd4e35427ab156d1e0b28745c926d0253a72cd (patch)
treedd54f62544f0f2c1570ac44d1416573c4296d278
parent964bc37f6c95308a64aa96534b29412ce55835fd (diff)
downloadparted-fabd4e35427ab156d1e0b28745c926d0253a72cd.tar.gz
Move Exception Option values into enum
Adding enums together doesn't create a new enum value, so when compiling with warnings you will get warnings like: warning: case value ‘96’ not in enumerated type for PED_EXCEPTION_IGNORE_CANCEL This moved the defines into the enum as new values so that they are recognized as valid members of the enum with the values staying the same. NOTE: PED_EXCEPTION_OPTION_LAST *MUST* be the last of the individual options, not the combined options. Thanks to D. Hugh Redelmeier for this patch.
-rw-r--r--include/parted/exception.in.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/parted/exception.in.h b/include/parted/exception.in.h
index 20abb08..3b131fe 100644
--- a/include/parted/exception.in.h
+++ b/include/parted/exception.in.h
@@ -46,6 +46,7 @@ typedef enum _PedExceptionType PedExceptionType;
* Option for resolving the exception
*/
enum _PedExceptionOption {
+ /* individual options */
PED_EXCEPTION_UNHANDLED=0,
PED_EXCEPTION_FIX=1,
PED_EXCEPTION_YES=2,
@@ -54,19 +55,23 @@ enum _PedExceptionOption {
PED_EXCEPTION_RETRY=16,
PED_EXCEPTION_IGNORE=32,
PED_EXCEPTION_CANCEL=64,
+
+ /* combinations of individual options */
+ PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL,
+ PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO,
+ PED_EXCEPTION_YES_NO_CANCEL =
+ PED_EXCEPTION_YES_NO + PED_EXCEPTION_CANCEL,
+ PED_EXCEPTION_IGNORE_CANCEL =
+ PED_EXCEPTION_IGNORE + PED_EXCEPTION_CANCEL,
+ PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL,
+ PED_EXCEPTION_RETRY_IGNORE_CANCEL =
+ PED_EXCEPTION_RETRY + PED_EXCEPTION_IGNORE_CANCEL,
};
-typedef enum _PedExceptionOption PedExceptionOption;
-#define PED_EXCEPTION_OK_CANCEL (PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL)
-#define PED_EXCEPTION_YES_NO (PED_EXCEPTION_YES + PED_EXCEPTION_NO)
-#define PED_EXCEPTION_YES_NO_CANCEL (PED_EXCEPTION_YES_NO \
- + PED_EXCEPTION_CANCEL)
-#define PED_EXCEPTION_IGNORE_CANCEL (PED_EXCEPTION_IGNORE \
- + PED_EXCEPTION_CANCEL)
-#define PED_EXCEPTION_RETRY_CANCEL (PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL)
-#define PED_EXCEPTION_RETRY_IGNORE_CANCEL (PED_EXCEPTION_RETRY \
- + PED_EXCEPTION_IGNORE_CANCEL)
+
#define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX
-#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL
+#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL /* last individual option */
+
+typedef enum _PedExceptionOption PedExceptionOption;
/**
* Structure with information about exception