From d610c572f204cc38bcd59e4e26ba260ae8b13c91 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 31 Dec 2017 16:27:45 -0600 Subject: [PATCH] Revert some changes to work around ORCA/C issues that have been addressed. Most of these are trailing commas in enums. There are also a couple preprocessor bug workarounds that are no longer necessary. As of this version, ORCA/C 2.2.0 B2 or later should be used to compile hush. --- README.md | 2 +- coreutils/echo.c | 2 +- include/libbb.h | 8 ++++---- include/platform.h | 6 +++--- include/unicode.h | 4 ++-- libbb/getopt32.c | 2 +- libbb/lineedit.c | 2 +- shell/hush.c | 10 +++++----- shell/match.h | 2 +- shell/random.c | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a394cbb20..fe4e2dba8 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ that expect a Bourne-type shell in that location). Building -------- -To build it, you also need ORCA/C 2.1.x and plenty of memory (8MB is enough). +To build it, you also need ORCA/C 2.2.x and plenty of memory (8MB is enough). You also need to have a copy of the ltermcap library from GNO 2.0.4 installed as `/usr/lib/libtermcap.204` (the GNO 2.0.6 version is broken and won't work). Run `make` or (if the source files don't have correct filetypes) `make build`. diff --git a/coreutils/echo.c b/coreutils/echo.c index 0c24fe724..eae428dbd 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -73,7 +73,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv) #if !ENABLE_FEATURE_FANCY_ECHO enum { eflag = '\\', - nflag = 1 /* 1 -- print '\n' */ + nflag = 1, /* 1 -- print '\n' */ }; argv++; diff --git a/include/libbb.h b/include/libbb.h index 0ed57c952..1bf4d9971 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -382,7 +382,7 @@ enum { ACTION_DEPTHFIRST = (1 << 3), /*ACTION_REVERSE = (1 << 4), - unused */ ACTION_QUIET = (1 << 5), - ACTION_DANGLING_OK = (1 << 6) + ACTION_DANGLING_OK = (1 << 6), }; typedef uint8_t recurse_flags_t; extern int recursive_action(const char *fileName, unsigned flags, @@ -684,7 +684,7 @@ void fputc_printable(int ch, FILE *file) FAST_FUNC; * Buffer must hold at least four characters. */ enum { VISIBLE_ENDLINE = 1 << 0, - VISIBLE_SHOW_TABS = 1 << 1 + VISIBLE_SHOW_TABS = 1 << 1, }; void visible(unsigned ch, char *buf, int flags) FAST_FUNC; @@ -974,7 +974,7 @@ enum { DAEMON_DEVNULL_STDIO = 2, DAEMON_CLOSE_EXTRA_FDS = 4, DAEMON_ONLY_SANITIZE = 8, /* internal use */ - DAEMON_DOUBLE_FORK = 16 /* double fork to avoid controlling tty */ + DAEMON_DOUBLE_FORK = 16, /* double fork to avoid controlling tty */ }; #if BB_MMU # define fork_or_rexec(argv) xfork() @@ -1435,7 +1435,7 @@ enum { USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION, VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI, WITH_PATH_LOOKUP = 0x10, - FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION + FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, }; line_input_t *new_line_input_t(int flags) FAST_FUNC; /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ diff --git a/include/platform.h b/include/platform.h index 69b1a71ce..05f09bae9 100644 --- a/include/platform.h +++ b/include/platform.h @@ -44,9 +44,6 @@ # define __const const #endif -/* used by unit test machinery to run registration functions before calling main() */ -#define INIT_FUNC __attribute__ ((constructor)) - #define UNUSED_PARAM __attribute__ ((__unused__)) #define NORETURN __attribute__ ((__noreturn__)) /* "The malloc attribute is used to tell the compiler that a function @@ -84,6 +81,9 @@ # define UNUSED_PARAM_RESULT #endif +/* used by unit test machinery to run registration functions before calling main() */ +#define INIT_FUNC __attribute__ ((constructor)) + /* -fwhole-program makes all symbols local. The attribute externally_visible * forces a symbol global. */ #if __GNUC_PREREQ(4,1) diff --git a/include/unicode.h b/include/unicode.h index 83f15b366..0317a2151 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -15,7 +15,7 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN enum { UNICODE_UNKNOWN = 0, UNICODE_OFF = 1, - UNICODE_ON = 2 + UNICODE_ON = 2, }; #define unicode_bidi_isrtl(wc) 0 @@ -56,7 +56,7 @@ size_t FAST_FUNC unicode_strlen(const char *string); /* Width on terminal */ size_t FAST_FUNC unicode_strwidth(const char *string); enum { - UNI_FLAG_PAD = (1 << 0) + UNI_FLAG_PAD = (1 << 0), }; //UNUSED: unsigned FAST_FUNC unicode_padding_to_width(unsigned width, const char *src); //UNUSED: char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags); diff --git a/libbb/getopt32.c b/libbb/getopt32.c index cc984e31b..b974bc123 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -312,7 +312,7 @@ const char *opt_complementary; enum { PARAM_STRING, PARAM_LIST, - PARAM_INT + PARAM_INT, }; typedef struct { diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 8ac3b09ef..c70c772ce 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -845,7 +845,7 @@ static NOINLINE unsigned complete_username(const char *ud) enum { FIND_EXE_ONLY = 0, FIND_DIR_ONLY = 1, - FIND_FILE_ONLY = 2 + FIND_FILE_ONLY = 2, }; #ifndef __GNO__ diff --git a/shell/hush.c b/shell/hush.c index a14228b15..2ec44e3aa 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -466,7 +466,7 @@ enum { EXP_FLAG_GLOB = 0x2, /* Protect newly added chars against globbing * by prepending \ to *, ?, [, \ */ - EXP_FLAG_ESC_GLOB_CHARS = 0x1 + EXP_FLAG_ESC_GLOB_CHARS = 0x1, }; enum { MAYBE_ASSIGNMENT = 0, @@ -546,7 +546,7 @@ typedef enum redir_type { /* otherwise, rd_fd is redirected to rd_dup */ HEREDOC_SKIPTABS = 1, - HEREDOC_QUOTED = 2 + HEREDOC_QUOTED = 2, } redir_type; @@ -619,7 +619,7 @@ typedef enum pipe_style { PIPE_SEQ = 1, PIPE_AND = 2, PIPE_OR = 3, - PIPE_BG = 4 + PIPE_BG = 4, } pipe_style; /* Is there anything in this pipe at all? */ #define IS_NULL_PIPE(pi) \ @@ -678,7 +678,7 @@ struct variable { enum { BC_BREAK = 1, - BC_CONTINUE = 2 + BC_CONTINUE = 2, }; #if ENABLE_HUSH_FUNCTIONS @@ -7937,7 +7937,7 @@ static int run_list(struct pipe *pi) } } last_followup = pi->followup; - IF_HAS_KEYWORDS(last_rword = rword); /* ; outside to avoid ORCA/C bug */ + IF_HAS_KEYWORDS(last_rword = rword;) #if ENABLE_HUSH_IF if (cond_code) { if (rword == RES_THEN) { diff --git a/shell/match.h b/shell/match.h index 073dcb545..aa393ed1a 100644 --- a/shell/match.h +++ b/shell/match.h @@ -11,7 +11,7 @@ enum { SCAN_MOVE_FROM_LEFT = (1 << 0), SCAN_MOVE_FROM_RIGHT = (1 << 1), SCAN_MATCH_LEFT_HALF = (1 << 2), - SCAN_MATCH_RIGHT_HALF = (1 << 3) + SCAN_MATCH_RIGHT_HALF = (1 << 3), }; char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags); diff --git a/shell/random.c b/shell/random.c index 2db734e5b..bb5548a3b 100644 --- a/shell/random.c +++ b/shell/random.c @@ -48,7 +48,7 @@ next_random(random_t *rnd) enum { a = 2, b = 7, - c = 3 + c = 3, }; uint32_t t;