diff options
| author | Paul Eggert | 2013-06-03 11:29:30 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-06-03 11:29:30 -0700 |
| commit | 3d5ee10aa258a500e0b70b5eabe9d58cb3ab051e (patch) | |
| tree | 37d030ec632685a294eb351851fdad8ce41800b0 /src | |
| parent | 068922a2973033ea826b458a17f3e06cf6b44299 (diff) | |
| download | emacs-3d5ee10aa258a500e0b70b5eabe9d58cb3ab051e.tar.gz emacs-3d5ee10aa258a500e0b70b5eabe9d58cb3ab051e.zip | |
Fix minor problems found by static checking.
* data.c (pure_write_error):
Use xsignal2, not Fsignal, as Fsignal might return.
* eval.c (set_backtrace_debug_on_exit): Now static.
(backtrace_p, backtrace_top, backtrace_next, record_in_backtrace):
No longer inline. EXTERN_INLINE is needed only for functions
defined in .h files. Reindent function header as per GNU style.
(backtrace_p, backtrace_top, backtrace_next):
Mark EXTERNALLY_VISIBLE so they don't get optimized away by the
compiler or linker. Add extern decls to pacify gcc -Wall.
* frame.c, frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource):
Now static.
* frame.c (free_monitors): Define only on platforms that need it.
* nsterm.m (ns_term_init):
* process.c (catch_child_signal):
Don't worry about whether SIGCHLD is defined, as SIGCHLD is
defined on all porting targets these days.
* process.c, process.h (catch_child_signal):
Make it extern only if NS_IMPL_GNUSTEP is defined.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 22 | ||||
| -rw-r--r-- | src/data.c | 3 | ||||
| -rw-r--r-- | src/eval.c | 23 | ||||
| -rw-r--r-- | src/frame.c | 7 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 8 | ||||
| -rw-r--r-- | src/process.c | 5 | ||||
| -rw-r--r-- | src/process.h | 2 |
8 files changed, 53 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a1aa4efcc86..b3b6f4730f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2013-06-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix minor problems found by static checking. | ||
| 4 | * data.c (pure_write_error): | ||
| 5 | Use xsignal2, not Fsignal, as Fsignal might return. | ||
| 6 | * eval.c (set_backtrace_debug_on_exit): Now static. | ||
| 7 | (backtrace_p, backtrace_top, backtrace_next, record_in_backtrace): | ||
| 8 | No longer inline. EXTERN_INLINE is needed only for functions | ||
| 9 | defined in .h files. Reindent function header as per GNU style. | ||
| 10 | (backtrace_p, backtrace_top, backtrace_next): | ||
| 11 | Mark EXTERNALLY_VISIBLE so they don't get optimized away by the | ||
| 12 | compiler or linker. Add extern decls to pacify gcc -Wall. | ||
| 13 | * frame.c, frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): | ||
| 14 | Now static. | ||
| 15 | * frame.c (free_monitors): Define only on platforms that need it. | ||
| 16 | * nsterm.m (ns_term_init): | ||
| 17 | * process.c (catch_child_signal): | ||
| 18 | Don't worry about whether SIGCHLD is defined, as SIGCHLD is | ||
| 19 | defined on all porting targets these days. | ||
| 20 | * process.c, process.h (catch_child_signal): | ||
| 21 | Make it extern only if NS_IMPL_GNUSTEP is defined. | ||
| 22 | |||
| 1 | 2013-06-03 Eli Zaretskii <eliz@gnu.org> | 23 | 2013-06-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 24 | ||
| 3 | * w32.c (gettimeofday): Make the signature identical to prototype | 25 | * w32.c (gettimeofday): Make the signature identical to prototype |
diff --git a/src/data.c b/src/data.c index fc66cea6497..9f756de014a 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -102,8 +102,7 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) | |||
| 102 | void | 102 | void |
| 103 | pure_write_error (Lisp_Object obj) | 103 | pure_write_error (Lisp_Object obj) |
| 104 | { | 104 | { |
| 105 | Fsignal (Qerror, Fcons (build_string ("Attempt to modify read-only object"), | 105 | xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj); |
| 106 | Fcons (obj, Qnil))); | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | void | 108 | void |
diff --git a/src/eval.c b/src/eval.c index d6236b6edf2..d1d074df777 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -117,21 +117,29 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); | |||
| 117 | 117 | ||
| 118 | /* Functions to modify slots of backtrace records. */ | 118 | /* Functions to modify slots of backtrace records. */ |
| 119 | 119 | ||
| 120 | static void set_backtrace_args (struct specbinding *pdl, Lisp_Object *args) | 120 | static void |
| 121 | set_backtrace_args (struct specbinding *pdl, Lisp_Object *args) | ||
| 121 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; } | 122 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; } |
| 122 | 123 | ||
| 123 | static void set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n) | 124 | static void |
| 125 | set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n) | ||
| 124 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; } | 126 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; } |
| 125 | 127 | ||
| 126 | void set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) | 128 | static void |
| 129 | set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) | ||
| 127 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; } | 130 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; } |
| 128 | 131 | ||
| 129 | /* Helper functions to scan the backtrace. */ | 132 | /* Helper functions to scan the backtrace. */ |
| 130 | 133 | ||
| 131 | EXTERN_INLINE bool backtrace_p (struct specbinding *pdl) | 134 | bool backtrace_p (struct specbinding *) EXTERNALLY_VISIBLE; |
| 135 | struct specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; | ||
| 136 | struct specbinding *backtrace_next (struct specbinding *pdl) EXTERNALLY_VISIBLE; | ||
| 137 | |||
| 138 | bool backtrace_p (struct specbinding *pdl) | ||
| 132 | { return pdl >= specpdl; } | 139 | { return pdl >= specpdl; } |
| 133 | 140 | ||
| 134 | EXTERN_INLINE struct specbinding *backtrace_top (void) | 141 | struct specbinding * |
| 142 | backtrace_top (void) | ||
| 135 | { | 143 | { |
| 136 | struct specbinding *pdl = specpdl_ptr - 1; | 144 | struct specbinding *pdl = specpdl_ptr - 1; |
| 137 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) | 145 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) |
| @@ -139,7 +147,8 @@ EXTERN_INLINE struct specbinding *backtrace_top (void) | |||
| 139 | return pdl; | 147 | return pdl; |
| 140 | } | 148 | } |
| 141 | 149 | ||
| 142 | EXTERN_INLINE struct specbinding *backtrace_next (struct specbinding *pdl) | 150 | struct specbinding * |
| 151 | backtrace_next (struct specbinding *pdl) | ||
| 143 | { | 152 | { |
| 144 | pdl--; | 153 | pdl--; |
| 145 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) | 154 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) |
| @@ -1925,7 +1934,7 @@ grow_specpdl (void) | |||
| 1925 | specpdl_ptr = specpdl + count; | 1934 | specpdl_ptr = specpdl + count; |
| 1926 | } | 1935 | } |
| 1927 | 1936 | ||
| 1928 | LISP_INLINE void | 1937 | void |
| 1929 | record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) | 1938 | record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) |
| 1930 | { | 1939 | { |
| 1931 | eassert (nargs >= UNEVALLED); | 1940 | eassert (nargs >= UNEVALLED); |
diff --git a/src/frame.c b/src/frame.c index e88432b9802..a207ef690da 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -114,7 +114,7 @@ Lisp_Object Qface_set_after_frame_default; | |||
| 114 | 114 | ||
| 115 | static Lisp_Object Qdelete_frame_functions; | 115 | static Lisp_Object Qdelete_frame_functions; |
| 116 | 116 | ||
| 117 | Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | 117 | static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; |
| 118 | 118 | ||
| 119 | #ifdef HAVE_WINDOW_SYSTEM | 119 | #ifdef HAVE_WINDOW_SYSTEM |
| 120 | static void x_report_frame_params (struct frame *, Lisp_Object *); | 120 | static void x_report_frame_params (struct frame *, Lisp_Object *); |
| @@ -167,7 +167,7 @@ struct frame * | |||
| 167 | decode_window_system_frame (Lisp_Object frame) | 167 | decode_window_system_frame (Lisp_Object frame) |
| 168 | { | 168 | { |
| 169 | struct frame *f = decode_live_frame (frame); | 169 | struct frame *f = decode_live_frame (frame); |
| 170 | 170 | ||
| 171 | if (!window_system_available (f)) | 171 | if (!window_system_available (f)) |
| 172 | error ("Window system frame should be used"); | 172 | error ("Window system frame should be used"); |
| 173 | return f; | 173 | return f; |
| @@ -4138,6 +4138,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) | |||
| 4138 | 4138 | ||
| 4139 | #ifdef HAVE_WINDOW_SYSTEM | 4139 | #ifdef HAVE_WINDOW_SYSTEM |
| 4140 | 4140 | ||
| 4141 | # if (defined HAVE_NS \ | ||
| 4142 | || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) | ||
| 4141 | void | 4143 | void |
| 4142 | free_monitors (struct MonitorInfo *monitors, int n_monitors) | 4144 | free_monitors (struct MonitorInfo *monitors, int n_monitors) |
| 4143 | { | 4145 | { |
| @@ -4146,6 +4148,7 @@ free_monitors (struct MonitorInfo *monitors, int n_monitors) | |||
| 4146 | xfree (monitors[i].name); | 4148 | xfree (monitors[i].name); |
| 4147 | xfree (monitors); | 4149 | xfree (monitors); |
| 4148 | } | 4150 | } |
| 4151 | # endif | ||
| 4149 | 4152 | ||
| 4150 | Lisp_Object | 4153 | Lisp_Object |
| 4151 | make_monitor_attribute_list (struct MonitorInfo *monitors, | 4154 | make_monitor_attribute_list (struct MonitorInfo *monitors, |
diff --git a/src/frame.h b/src/frame.h index 12aa48b2d92..31d3e73c3c3 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1198,8 +1198,6 @@ extern Lisp_Object Qdisplay; | |||
| 1198 | 1198 | ||
| 1199 | extern Lisp_Object Qrun_hook_with_args; | 1199 | extern Lisp_Object Qrun_hook_with_args; |
| 1200 | 1200 | ||
| 1201 | extern Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | ||
| 1202 | |||
| 1203 | #ifdef HAVE_WINDOW_SYSTEM | 1201 | #ifdef HAVE_WINDOW_SYSTEM |
| 1204 | 1202 | ||
| 1205 | /* The class of this X application. */ | 1203 | /* The class of this X application. */ |
diff --git a/src/nsterm.m b/src/nsterm.m index 9cf138837f6..93f693fe55e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -4361,7 +4361,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 4361 | [NSApp run]; | 4361 | [NSApp run]; |
| 4362 | ns_do_open_file = YES; | 4362 | ns_do_open_file = YES; |
| 4363 | 4363 | ||
| 4364 | #if defined (NS_IMPL_GNUSTEP) && defined (SIGCHLD) | 4364 | #ifdef NS_IMPL_GNUSTEP |
| 4365 | /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask. | 4365 | /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask. |
| 4366 | We must re-catch it so subprocess works. */ | 4366 | We must re-catch it so subprocess works. */ |
| 4367 | catch_child_signal (); | 4367 | catch_child_signal (); |
| @@ -5600,7 +5600,7 @@ not_in_argv (NSString *arg) | |||
| 5600 | #ifdef NS_IMPL_GNUSTEP | 5600 | #ifdef NS_IMPL_GNUSTEP |
| 5601 | gsextra = 3; | 5601 | gsextra = 3; |
| 5602 | #endif | 5602 | #endif |
| 5603 | 5603 | ||
| 5604 | NSTRACE (windowWillResize); | 5604 | NSTRACE (windowWillResize); |
| 5605 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ | 5605 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ |
| 5606 | 5606 | ||
| @@ -5666,7 +5666,7 @@ not_in_argv (NSString *arg) | |||
| 5666 | 5666 | ||
| 5667 | - (void)windowDidResize: (NSNotification *)notification | 5667 | - (void)windowDidResize: (NSNotification *)notification |
| 5668 | { | 5668 | { |
| 5669 | if (! [self fsIsNative]) | 5669 | if (! [self fsIsNative]) |
| 5670 | { | 5670 | { |
| 5671 | NSWindow *theWindow = [notification object]; | 5671 | NSWindow *theWindow = [notification object]; |
| 5672 | /* We can get notification on the non-FS window when in | 5672 | /* We can get notification on the non-FS window when in |
| @@ -6115,7 +6115,7 @@ not_in_argv (NSString *arg) | |||
| 6115 | } | 6115 | } |
| 6116 | } | 6116 | } |
| 6117 | #endif | 6117 | #endif |
| 6118 | 6118 | ||
| 6119 | - (void)toggleFullScreen: (id)sender | 6119 | - (void)toggleFullScreen: (id)sender |
| 6120 | { | 6120 | { |
| 6121 | NSWindow *w, *fw; | 6121 | NSWindow *w, *fw; |
diff --git a/src/process.c b/src/process.c index 9df003fa3a3..8c4199e5eed 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -7029,14 +7029,15 @@ integer or floating point values. | |||
| 7029 | return system_process_attributes (pid); | 7029 | return system_process_attributes (pid); |
| 7030 | } | 7030 | } |
| 7031 | 7031 | ||
| 7032 | #ifndef NS_IMPL_GNUSTEP | ||
| 7033 | static | ||
| 7034 | #endif | ||
| 7032 | void | 7035 | void |
| 7033 | catch_child_signal (void) | 7036 | catch_child_signal (void) |
| 7034 | { | 7037 | { |
| 7035 | #ifdef SIGCHLD | ||
| 7036 | struct sigaction action; | 7038 | struct sigaction action; |
| 7037 | emacs_sigaction_init (&action, deliver_child_signal); | 7039 | emacs_sigaction_init (&action, deliver_child_signal); |
| 7038 | sigaction (SIGCHLD, &action, 0); | 7040 | sigaction (SIGCHLD, &action, 0); |
| 7039 | #endif | ||
| 7040 | } | 7041 | } |
| 7041 | 7042 | ||
| 7042 | 7043 | ||
diff --git a/src/process.h b/src/process.h index 9455df18beb..0c4e17e68cf 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -217,6 +217,8 @@ extern void add_read_fd (int fd, fd_callback func, void *data); | |||
| 217 | extern void delete_read_fd (int fd); | 217 | extern void delete_read_fd (int fd); |
| 218 | extern void add_write_fd (int fd, fd_callback func, void *data); | 218 | extern void add_write_fd (int fd, fd_callback func, void *data); |
| 219 | extern void delete_write_fd (int fd); | 219 | extern void delete_write_fd (int fd); |
| 220 | #ifdef NS_IMPL_GNUSTEP | ||
| 220 | extern void catch_child_signal (void); | 221 | extern void catch_child_signal (void); |
| 222 | #endif | ||
| 221 | 223 | ||
| 222 | INLINE_HEADER_END | 224 | INLINE_HEADER_END |