78 lines
2.8 KiB
Diff
78 lines
2.8 KiB
Diff
|
From fabd4e35427ab156d1e0b28745c926d0253a72cd Mon Sep 17 00:00:00 2001
|
|||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
|||
|
Date: Tue, 10 Aug 2021 09:40:28 -0700
|
|||
|
Subject: [PATCH 25/30] Move Exception Option values into enum
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
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.
|
|||
|
---
|
|||
|
include/parted/exception.in.h | 27 ++++++++++++++++-----------
|
|||
|
1 file 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
|
|||
|
--
|
|||
|
2.31.1
|
|||
|
|