1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix more compiler warnings, typos and other minor issues (#260)

Many of these changes are minor typo fixes. The other changes
(which are mostly compiler warning fixes) are:

NEWS:
- The --globcasedetect shell option works on older Linux kernels
  when used with FAT32/VFAT file systems, so remove the note about
  it only working with 5.2+ kernels.

src/cmd/ksh93/COMPATIBILITY:
- Update the documentation on function scoping with an addition
  from ksh93v- (this does apply to ksh93u+).

src/cmd/ksh93/edit/emacs.c:
- Check for '_AST_ksh_release', not 'AST_ksh_release'.

src/cmd/INIT/mamake.c,
src/cmd/INIT/ratz.c,
src/cmd/INIT/release.c,
src/cmd/builtin/pty.c:
- Add more uses of UNREACHABLE() and noreturn, this time for the
  build system and pty.

src/cmd/builtin/pty.c,
src/cmd/builtin/array.c,
src/cmd/ksh93/sh/name.c,
src/cmd/ksh93/sh/nvtype.c,
src/cmd/ksh93/sh/suid_exec.c:
- Fix six -Wunused-variable warnings (the name.c nv_arrayptr()
  fixes are also in ksh93v-).
- Remove the unused 'tableval' function to fix a -Wunused-function
  warning.

src/cmd/ksh93/sh/lex.c:
- Remove unused 'SHOPT_DOS' code, which isn't enabled anywhere.
  https://github.com/att/ast/issues/272#issuecomment-354363112

src/cmd/ksh93/bltins/misc.c,
src/cmd/ksh93/bltins/trap.c,
src/cmd/ksh93/bltins/typeset.c:
- Add dictionary generator function declarations for former
  aliases that are now builtins (re: 1fbbeaa1, ef1621c1, 3ba4900e).
- For consistency with the rest of the codebase, use '(void)'
  instead of '()' for print_cpu_times.

src/cmd/ksh93/sh/init.c,
src/lib/libast/path/pathshell.c:
- Move the otherwise unused EXE macro to pathshell() and only
  search for 'sh.exe' on Windows.

src/cmd/ksh93/sh/xec.c,
src/lib/libast/include/ast.h:
- Add an empty definition for inline when compiling with C89.
  This allows the timeval_to_double() function to be inlined.

src/cmd/ksh93/include/shlex.h:
- Remove the unused 'PIPESYM2' macro.

src/cmd/ksh93/tests/pty.sh:
- Add '# err_exit #' to count the regression test added in
  commit 113a9392.

src/lib/libast/disc/sfdcdio.c:
- Move diordwr, dioread, diowrite and dioexcept behind
  '#ifdef F_DIOINFO' to fix one -Wunused-variable warning and
  multiple -Wunused-function warnings (sfdcdio() only uses these
  functions when F_DIOINFO is defined).

src/lib/libast/string/fmtdev.c:
- Fix two -Wimplicit-function-declaration warnings on Linux by
  including sys/sysmacros.h in fmtdev().
This commit is contained in:
Johnothan King 2021-04-08 11:58:07 -07:00 committed by GitHub
parent ecf260c282
commit a065558291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 299 additions and 282 deletions

View file

@ -120,7 +120,7 @@ struct argnod
#define ARG_QUOTED 0x20 /* word contained quote characters */
#define ARG_MESSAGE 0x40 /* contains international string */
#define ARG_APPEND 0x80 /* for += assignment */
/* The following can be passed as options to sh_macexpand() */
/* The following can be passed as options to sh_macexpand() */
#define ARG_ARITH 0x100 /* arithmetic expansion */
#define ARG_OPTIMIZE 0x200 /* try to optimize */
#define ARG_NOGLOB 0x400 /* no file name expansion */

View file

@ -81,7 +81,7 @@ struct sh_scoped
char *funname;
int lineno;
Dt_t *save_tree; /* var_tree for calling function */
struct sh_scoped *self; /* pointer to copy of this scope*/
struct sh_scoped *self; /* pointer to copy of this scope */
Dt_t *var_local; /* local level variables for name() */
struct slnod *staklist; /* link list of function stacks */
int states; /* shell state bits used by sh_isstate(), etc. */
@ -163,12 +163,12 @@ struct shared
char *lastarg; \
char *lastpath; /* last absolute path found */ \
int path_err; /* last error on path search */ \
Dt_t *track_tree; /* for tracked aliases*/ \
Dt_t *track_tree; /* for tracked aliases */ \
Dt_t *var_base; /* global level variables */ \
Dt_t *openmatch; \
Namval_t *namespace; /* current active namespace*/ \
Namval_t *last_table; /* last table used in last nv_open */ \
Namval_t *prev_table; /* previous table used in nv_open */ \
Namval_t *namespace; /* current active namespace */ \
Namval_t *last_table; /* last table used in last nv_open */ \
Namval_t *prev_table; /* previous table used in nv_open */ \
Sfio_t *outpool; /* output stream pool */ \
long timeout; /* read timeout */ \
unsigned int curenv; /* current subshell number */ \

View file

@ -127,7 +127,7 @@ typedef struct edit
struct termio e_ott;
#endif
int *e_globals; /* global variables */
genchar *e_window; /* display window image */
genchar *e_window; /* display window image */
char e_inmacro; /* processing macro expansion */
#if KSHELL
char e_vi_insert[2]; /* for sh_keytrap */

View file

@ -47,7 +47,7 @@
#define S_RBRA 26 /* right brace after $ */
#define S_PAR 27 /* set for $( */
#define S_ENDCH 28 /* macro expansion terminator */
#define S_SLASH 29 /* / character terminates ~ expansion */
#define S_SLASH 29 /* / character terminates ~ expansion */
#define S_COLON 30 /* for character : */
#define S_LABEL 31 /* for goto label */
#define S_EDOL 32 /* ends $identifier */

View file

@ -88,7 +88,7 @@ struct Namarray
void *(*fun)(Namval_t*,const char*,int); /* associative arrays */
void *fixed; /* for fixed sized arrays */
Dt_t *table; /* for subscripts */
void *scope; /* non-zerp when scoped */
void *scope; /* non-zero when scoped */
};
/* The context pointer for declaration command */
@ -167,7 +167,7 @@ struct Namval
#define NV_HEXFLOAT (NV_LTOU) /* for C99 base16 float notation */
#define NV_FLTSIZEZERO -1 /* a float with size of 0 being <0 */
/* options for nv_open */
/* options for nv_open */
#define NV_APPEND 0x10000 /* append value */
#define NV_MOVE 0x8000000 /* for use with nv_clone */
@ -231,7 +231,7 @@ struct Namval
#define ARRAY_UNDEF (4L<<ARRAY_BITS) /* For ${array} */
/* These are disciplines provided by the library for use with nv_discfun */
/* These are disciplines provided by the library for use with nv_discfun */
#define NV_DCADD 0 /* used to add named disciplines */
#define NV_DCRESTRICT 1 /* variable that are restricted in rsh */
@ -242,7 +242,7 @@ struct Namval
# define extern __IMPORT__
# endif /* _BLD_shell */
#endif /* _DLL */
/* prototype for array interface*/
/* prototype for array interface */
extern Namarr_t *nv_arrayptr(Namval_t*);
extern Namarr_t *nv_setarray(Namval_t*,void*(*)(Namval_t*,const char*,int));
extern int nv_arraynsub(Namarr_t*);
@ -285,7 +285,7 @@ extern void nv_setvec(Namval_t*,int,int,char*[]);
extern void nv_setvtree(Namval_t*);
extern int nv_setsize(Namval_t*,int);
extern Namfun_t *nv_disc(Namval_t*,Namfun_t*,int);
extern void nv_unset(Namval_t*); /*obsolete */
extern void nv_unset(Namval_t*); /* obsolete */
extern void _nv_unset(Namval_t*,int);
extern Namval_t *nv_search(const char *, Dt_t*, int);
extern char *nv_name(Namval_t*);

View file

@ -45,7 +45,7 @@
#define PATH_STD_DIR 0100 /* directory is on $(getconf PATH) */
#define PATH_OFFSET 2 /* path offset for path_join */
#define MAXDEPTH (sizeof(char*)==2?64:1024) /* maximum recursion depth*/
#define MAXDEPTH (sizeof(char*)==2?64:1024) /* maximum recursion depth */
/*
* path component structure for path searching

View file

@ -113,7 +113,6 @@ typedef struct _shlex_
#define IORDWRSYM (SYMGT|'<')
#define IORDWRSYMT (SYMSEMI|'<')
#define IOCLOBSYM (SYMPIPE|'>')
#define PIPESYM2 (SYMPIPE|'&')
#define IPROCSYM (SYMLPAR|'<')
#define OPROCSYM (SYMLPAR|'>')
#define EOFSYM 04000 /* end-of-file */

View file

@ -37,15 +37,15 @@
#define FPOU (040<<COMBITS) /* output is a pipe */
#define FPCL (0100<<COMBITS) /* close the pipe */
#define FCOOP (0200<<COMBITS) /* cooperating process */
#define FSHOWME (0400<<COMBITS) /* set for showme commands */
#define FSHOWME (0400<<COMBITS) /* set for showme commands */
#define FALTPIPE (02000<<COMBITS) /* alternate pipes &| */
#define FPOSIX (02<<COMBITS) /* posix semantics function */
#define FLINENO (04<<COMBITS) /* for/case has line number */
#define FOPTGET (0200<<COMBITS) /* function calls getopts */
#define TNEGATE (01<<COMBITS) /* ! inside [[...]] */
#define TBINARY (02<<COMBITS) /* binary operator in [[...]] */
#define TUNARY (04<<COMBITS) /* unary operator in [[...]] */
#define TNEGATE (01<<COMBITS) /* ! inside [[ ... ]] */
#define TBINARY (02<<COMBITS) /* binary operator in [[ ... ]] */
#define TUNARY (04<<COMBITS) /* unary operator in [[ ... ]] */
#define TTEST (010<<COMBITS)
#define TPAREN (TBINARY|TUNARY)
#define TSHIFT (COMBITS+4)
@ -170,7 +170,7 @@ struct arithnod
};
/* types of ionodes stored in iofile */
/* types of ionodes stored in iofile */
#define IOUFD 0x3f /* file descriptor number mask */
#define IOPUT 0x40 /* > redirection operator */
#define IOAPP 0x80 /* >> redirection operator */

View file

@ -102,7 +102,7 @@ typedef struct _arith_
short elen;
} Arith_t;
#define ARITH_COMP 04 /* set when compile separate from execute */
#define ARITH_ASSIGNOP 010 /* set during assignment operators */
#define ARITH_ASSIGNOP 010 /* set during assignment operators */
#define MAXPREC 15 /* maximum precision level */
#define SEQPOINT 0200 /* sequence point */