summaryrefslogtreecommitdiff
path: root/src/bin/psql
diff options
context:
space:
mode:
authorPeter Eisentraut2023-10-26 07:16:25 +0000
committerPeter Eisentraut2023-10-26 07:20:54 +0000
commit611806cd726fc92989ac918eac48fd8d684869c7 (patch)
tree4ed4dc6fc9a1c5825bf42072e28312440484db28 /src/bin/psql
parentf0efa5aec19358e2282d4968a03db1db56f0ac3f (diff)
Add trailing commas to enum definitions
Since C99, there can be a trailing comma after the last value in an enum definition. A lot of new code has been introducing this style on the fly. Some new patches are now taking an inconsistent approach to this. Some add the last comma on the fly if they add a new last value, some are trying to preserve the existing style in each place, some are even dropping the last comma if there was one. We could nudge this all in a consistent direction if we just add the trailing commas everywhere once. I omitted a few places where there was a fixed "last" value that will always stay last. I also skipped the header files of libpq and ecpg, in case people want to use those with older compilers. There were also a small number of cases where the enum type wasn't used anywhere (but the enum values were), which ended up confusing pgindent a bit, so I left those alone. Discussion: https://www.postgresql.org/message-id/flat/386f8c45-c8ac-4681-8add-e3b0852c1620%40eisentraut.org
Diffstat (limited to 'src/bin/psql')
-rw-r--r--src/bin/psql/command.c2
-rw-r--r--src/bin/psql/command.h2
-rw-r--r--src/bin/psql/psqlscanslash.h2
-rw-r--r--src/bin/psql/settings.h12
-rw-r--r--src/bin/psql/startup.c2
5 files changed, 10 insertions, 10 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 4dfcf04fe03..82cc0915685 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -53,7 +53,7 @@
typedef enum EditableObjectType
{
EditableFunction,
- EditableView
+ EditableView,
} EditableObjectType;
/* local function declarations */
diff --git a/src/bin/psql/command.h b/src/bin/psql/command.h
index 9af85deeae1..b40fcaceb6f 100644
--- a/src/bin/psql/command.h
+++ b/src/bin/psql/command.h
@@ -19,7 +19,7 @@ typedef enum _backslashResult
PSQL_CMD_SKIP_LINE, /* keep building query */
PSQL_CMD_TERMINATE, /* quit program */
PSQL_CMD_NEWEDIT, /* query buffer was changed (e.g., via \e) */
- PSQL_CMD_ERROR /* the execution of the backslash command
+ PSQL_CMD_ERROR, /* the execution of the backslash command
* resulted in an error */
} backslashResult;
diff --git a/src/bin/psql/psqlscanslash.h b/src/bin/psql/psqlscanslash.h
index 7724242f371..c217f958f70 100644
--- a/src/bin/psql/psqlscanslash.h
+++ b/src/bin/psql/psqlscanslash.h
@@ -18,7 +18,7 @@ enum slash_option_type
OT_SQLID, /* treat as SQL identifier */
OT_SQLIDHACK, /* SQL identifier, but don't downcase */
OT_FILEPIPE, /* it's a filename or pipe */
- OT_WHOLE_LINE /* just snarf the rest of the line */
+ OT_WHOLE_LINE, /* just snarf the rest of the line */
};
diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h
index 1106954236d..78e9e9692e5 100644
--- a/src/bin/psql/settings.h
+++ b/src/bin/psql/settings.h
@@ -37,21 +37,21 @@ typedef enum
PSQL_ECHO_NONE,
PSQL_ECHO_QUERIES,
PSQL_ECHO_ERRORS,
- PSQL_ECHO_ALL
+ PSQL_ECHO_ALL,
} PSQL_ECHO;
typedef enum
{
PSQL_ECHO_HIDDEN_OFF,
PSQL_ECHO_HIDDEN_ON,
- PSQL_ECHO_HIDDEN_NOEXEC
+ PSQL_ECHO_HIDDEN_NOEXEC,
} PSQL_ECHO_HIDDEN;
typedef enum
{
PSQL_ERROR_ROLLBACK_OFF,
PSQL_ERROR_ROLLBACK_INTERACTIVE,
- PSQL_ERROR_ROLLBACK_ON
+ PSQL_ERROR_ROLLBACK_ON,
} PSQL_ERROR_ROLLBACK;
typedef enum
@@ -59,7 +59,7 @@ typedef enum
PSQL_COMP_CASE_PRESERVE_UPPER,
PSQL_COMP_CASE_PRESERVE_LOWER,
PSQL_COMP_CASE_UPPER,
- PSQL_COMP_CASE_LOWER
+ PSQL_COMP_CASE_LOWER,
} PSQL_COMP_CASE;
typedef enum
@@ -67,14 +67,14 @@ typedef enum
hctl_none = 0,
hctl_ignorespace = 1,
hctl_ignoredups = 2,
- hctl_ignoreboth = hctl_ignorespace | hctl_ignoredups
+ hctl_ignoreboth = hctl_ignorespace | hctl_ignoredups,
} HistControl;
enum trivalue
{
TRI_DEFAULT,
TRI_NO,
- TRI_YES
+ TRI_YES,
};
typedef struct _psqlSettings
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 5a28b6f7132..78526eb9dab 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -47,7 +47,7 @@ enum _actions
{
ACT_SINGLE_QUERY,
ACT_SINGLE_SLASH,
- ACT_FILE
+ ACT_FILE,
};
typedef struct SimpleActionListCell