diff options
| author | Paul Eggert | 2016-12-06 15:25:54 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-12-06 15:26:11 -0800 |
| commit | c95270ad4b48204880ae10ec730eb121ffa14abe (patch) | |
| tree | 1f14c9708a157112ed4cc2c176d7fe5233c4819b /src | |
| parent | 38d0276ad122d1a7663ecca965506f85b4e29b7f (diff) | |
| download | emacs-c95270ad4b48204880ae10ec730eb121ffa14abe.tar.gz emacs-c95270ad4b48204880ae10ec730eb121ffa14abe.zip | |
Change two _Noreturn functions to return void
This is a bit clearer than _Noreturn functions that (do not)
return a non-void type.
* src/callproc.c (call_process) [MSDOS]:
Use 'status' local to record status.
(child_setup): Return CHILD_SETUP_TYPE.
* src/data.c, src/lisp.h (wrong_type_argument): Return void.
All callers changed.
* src/lisp.h (CHILD_SETUP_TYPE): New macro.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 16 | ||||
| -rw-r--r-- | src/data.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 26 |
3 files changed, 26 insertions, 20 deletions
diff --git a/src/callproc.c b/src/callproc.c index dc3ca4ac102..02db3483ff2 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -293,7 +293,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 293 | Lisp_Object output_file = Qnil; | 293 | Lisp_Object output_file = Qnil; |
| 294 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 294 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
| 295 | char *tempfile = NULL; | 295 | char *tempfile = NULL; |
| 296 | int pid; | ||
| 297 | #else | 296 | #else |
| 298 | sigset_t oldset; | 297 | sigset_t oldset; |
| 299 | pid_t pid; | 298 | pid_t pid; |
| @@ -538,11 +537,9 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 538 | } | 537 | } |
| 539 | 538 | ||
| 540 | #ifdef MSDOS /* MW, July 1993 */ | 539 | #ifdef MSDOS /* MW, July 1993 */ |
| 541 | /* Note that on MSDOS `child_setup' actually returns the child process | 540 | status = child_setup (filefd, fd_output, fd_error, new_argv, 0, current_dir); |
| 542 | exit status, not its PID, so assign it to status below. */ | ||
| 543 | pid = child_setup (filefd, fd_output, fd_error, new_argv, 0, current_dir); | ||
| 544 | 541 | ||
| 545 | if (pid < 0) | 542 | if (status < 0) |
| 546 | { | 543 | { |
| 547 | child_errno = errno; | 544 | child_errno = errno; |
| 548 | unbind_to (count, Qnil); | 545 | unbind_to (count, Qnil); |
| @@ -551,7 +548,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 551 | code_convert_string_norecord (build_string (strerror (child_errno)), | 548 | code_convert_string_norecord (build_string (strerror (child_errno)), |
| 552 | Vlocale_coding_system, 0); | 549 | Vlocale_coding_system, 0); |
| 553 | } | 550 | } |
| 554 | status = pid; | ||
| 555 | 551 | ||
| 556 | for (i = 0; i < CALLPROC_FDS; i++) | 552 | for (i = 0; i < CALLPROC_FDS; i++) |
| 557 | if (0 <= callproc_fd[i]) | 553 | if (0 <= callproc_fd[i]) |
| @@ -1163,9 +1159,13 @@ exec_failed (char const *name, int err) | |||
| 1163 | CURRENT_DIR is an elisp string giving the path of the current | 1159 | CURRENT_DIR is an elisp string giving the path of the current |
| 1164 | directory the subprocess should have. Since we can't really signal | 1160 | directory the subprocess should have. Since we can't really signal |
| 1165 | a decent error from within the child, this should be verified as an | 1161 | a decent error from within the child, this should be verified as an |
| 1166 | executable directory by the parent. */ | 1162 | executable directory by the parent. |
| 1163 | |||
| 1164 | On GNUish hosts, either exec or return an error number. | ||
| 1165 | On MS-Windows, either return a pid or signal an error. | ||
| 1166 | On MS-DOS, either return an exit status or signal an error. */ | ||
| 1167 | 1167 | ||
| 1168 | int | 1168 | CHILD_SETUP_TYPE |
| 1169 | child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, | 1169 | child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, |
| 1170 | Lisp_Object current_dir) | 1170 | Lisp_Object current_dir) |
| 1171 | { | 1171 | { |
diff --git a/src/data.c b/src/data.c index eee2a52a37a..64cd8b23b46 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -138,7 +138,7 @@ wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) | |||
| 138 | make_number (bool_vector_size (a3))); | 138 | make_number (bool_vector_size (a3))); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | Lisp_Object | 141 | _Noreturn void |
| 142 | wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) | 142 | wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) |
| 143 | { | 143 | { |
| 144 | /* If VALUE is not even a valid Lisp object, we'd want to abort here | 144 | /* If VALUE is not even a valid Lisp object, we'd want to abort here |
| @@ -2924,7 +2924,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code, | |||
| 2924 | case Alogand: | 2924 | case Alogand: |
| 2925 | case Alogior: | 2925 | case Alogior: |
| 2926 | case Alogxor: | 2926 | case Alogxor: |
| 2927 | return wrong_type_argument (Qinteger_or_marker_p, val); | 2927 | wrong_type_argument (Qinteger_or_marker_p, val); |
| 2928 | case Amax: | 2928 | case Amax: |
| 2929 | if (!argnum || isnan (next) || next > accum) | 2929 | if (!argnum || isnan (next) || next > accum) |
| 2930 | accum = next; | 2930 | accum = next; |
diff --git a/src/lisp.h b/src/lisp.h index 7dd914542ed..3d39dc40dc2 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -309,7 +309,7 @@ error !; | |||
| 309 | #define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x) | 309 | #define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x) |
| 310 | #define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x) | 310 | #define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x) |
| 311 | #define lisp_h_CHECK_TYPE(ok, predicate, x) \ | 311 | #define lisp_h_CHECK_TYPE(ok, predicate, x) \ |
| 312 | ((ok) ? (void) 0 : (void) wrong_type_argument (predicate, x)) | 312 | ((ok) ? (void) 0 : wrong_type_argument (predicate, x)) |
| 313 | #define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons) | 313 | #define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons) |
| 314 | #define lisp_h_EQ(x, y) (XLI (x) == XLI (y)) | 314 | #define lisp_h_EQ(x, y) (XLI (x) == XLI (y)) |
| 315 | #define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float) | 315 | #define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float) |
| @@ -599,7 +599,7 @@ extern Lisp_Object char_table_ref (Lisp_Object, int); | |||
| 599 | extern void char_table_set (Lisp_Object, int, Lisp_Object); | 599 | extern void char_table_set (Lisp_Object, int, Lisp_Object); |
| 600 | 600 | ||
| 601 | /* Defined in data.c. */ | 601 | /* Defined in data.c. */ |
| 602 | extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); | 602 | extern _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object); |
| 603 | extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); | 603 | extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); |
| 604 | extern void notify_variable_watchers (Lisp_Object symbol, Lisp_Object newval, | 604 | extern void notify_variable_watchers (Lisp_Object symbol, Lisp_Object newval, |
| 605 | Lisp_Object operation, Lisp_Object where); | 605 | Lisp_Object operation, Lisp_Object where); |
| @@ -1270,16 +1270,20 @@ XSETCDR (Lisp_Object c, Lisp_Object n) | |||
| 1270 | INLINE Lisp_Object | 1270 | INLINE Lisp_Object |
| 1271 | CAR (Lisp_Object c) | 1271 | CAR (Lisp_Object c) |
| 1272 | { | 1272 | { |
| 1273 | return (CONSP (c) ? XCAR (c) | 1273 | if (CONSP (c)) |
| 1274 | : NILP (c) ? Qnil | 1274 | return XCAR (c); |
| 1275 | : wrong_type_argument (Qlistp, c)); | 1275 | if (!NILP (c)) |
| 1276 | wrong_type_argument (Qlistp, c); | ||
| 1277 | return Qnil; | ||
| 1276 | } | 1278 | } |
| 1277 | INLINE Lisp_Object | 1279 | INLINE Lisp_Object |
| 1278 | CDR (Lisp_Object c) | 1280 | CDR (Lisp_Object c) |
| 1279 | { | 1281 | { |
| 1280 | return (CONSP (c) ? XCDR (c) | 1282 | if (CONSP (c)) |
| 1281 | : NILP (c) ? Qnil | 1283 | return XCDR (c); |
| 1282 | : wrong_type_argument (Qlistp, c)); | 1284 | if (!NILP (c)) |
| 1285 | wrong_type_argument (Qlistp, c); | ||
| 1286 | return Qnil; | ||
| 1283 | } | 1287 | } |
| 1284 | 1288 | ||
| 1285 | /* Take the car or cdr of something whose type is not known. */ | 1289 | /* Take the car or cdr of something whose type is not known. */ |
| @@ -4223,9 +4227,11 @@ extern void setup_process_coding_systems (Lisp_Object); | |||
| 4223 | 4227 | ||
| 4224 | /* Defined in callproc.c. */ | 4228 | /* Defined in callproc.c. */ |
| 4225 | #ifndef DOS_NT | 4229 | #ifndef DOS_NT |
| 4226 | _Noreturn | 4230 | # define CHILD_SETUP_TYPE _Noreturn void |
| 4231 | #else | ||
| 4232 | # define CHILD_SETUP_TYPE int | ||
| 4227 | #endif | 4233 | #endif |
| 4228 | extern int child_setup (int, int, int, char **, bool, Lisp_Object); | 4234 | extern CHILD_SETUP_TYPE child_setup (int, int, int, char **, bool, Lisp_Object); |
| 4229 | extern void init_callproc_1 (void); | 4235 | extern void init_callproc_1 (void); |
| 4230 | extern void init_callproc (void); | 4236 | extern void init_callproc (void); |
| 4231 | extern void set_initial_environment (void); | 4237 | extern void set_initial_environment (void); |