aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2011-04-10 18:41:15 -0700
committerPaul Eggert2011-04-10 18:41:15 -0700
commit16a97296c05ec9d5bb4ffeae9dce90fc63f578ed (patch)
tree0801b434f760fd8dded7204501ffcdb82460720c /src/lisp.h
parent785bbd422461295890087ced24bfd87504032d0c (diff)
downloademacs-16a97296c05ec9d5bb4ffeae9dce90fc63f578ed.tar.gz
emacs-16a97296c05ec9d5bb4ffeae9dce90fc63f578ed.zip
Make Emacs functions such as Fatom 'static' by default.
This makes it easier for human readers (and static analyzers) to see whether these functions can be called from other modules. DEFUN now defines a static function. To make the function external so that it can be used in other C modules, use the new macro DEFUE. * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN. (DEFUN): Rewrite in terms of DEFINE_FUNC. It now generates a static function definition. Use DEFUE if you want an extern one. (DEFUE, INFUN): New macros. (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library): (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer): (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute): (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes): Remove decls, since these functions are now static. (Funintern, Fget_internal_run_time): New decls, since these functions were already external. * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c: * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c: * fns.c, font.c, fontset.c, frame.c, image.c, indent.c: * keyboard.c, keymap.c, lread.c: * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c: * syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c: Mark functions with DEFUE instead of DEFUN, if they are used in other modules. * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward decls for now-static functions. * buffer.h (Fdelete_overlay): Remove decl. * callproc.c (Fgetenv_internal): Mark as internal. * composite.c (Fremove_list_of_text_properties): Remove decl. (Fcomposition_get_gstring): New forward static decl. * composite.h (Fcomposite_get_gstring): Remove decl. * dired.c (Ffile_attributes): New forward static decl. * doc.c (Fdocumntation_property): New forward static decl. * eval.c (Ffetch_bytecode): New forward static decl. (Funintern): Remove extern decl; now in .h file where it belongs. * fileio.c (Fmake_symbolic_link): New forward static decl. * image.c (Finit_image_library): New forward static decl. * insdel.c (Fcombine_after_change_execute): Make forward decl static. * intervals.h (Fprevious_property_change): (Fremove_list_of_text_properties): Remove decls. * keyboard.c (Fthis_command_keys): Remove decl. (Fcommand_execute): New forward static decl. * keymap.c (Flookup_key): New forward static decl. (Fcopy_keymap): Now static. * keymap.h (Flookup_key): Remove decl. * process.c (Fget_process): New forward static decl. (Fprocess_datagram_address): Mark as internal. * syntax.c (Fsyntax_table_p): New forward static decl. (skip_chars): Remove duplicate decl. * textprop.c (Fprevious_property_change): New forward static decl. * window.c (Fset_window_fringes, Fset_window_scroll_bars): Now internal. (Fset_window_margins, Fset_window_vscroll): New forward static decls. * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 4859862c88f..6a28a0f81b3 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1804,8 +1804,12 @@ typedef struct {
1804 `doc' is documentation for the user. */ 1804 `doc' is documentation for the user. */
1805 1805
1806/* This version of DEFUN declares a function prototype with the right 1806/* This version of DEFUN declares a function prototype with the right
1807 arguments, so we can catch errors with maxargs at compile-time. */ 1807 arguments, so we can catch errors with maxargs at compile-time.
1808#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 1808 DEFUN defines an internal function, and DEFUE is similar but defines a
1809 external function, which can be used in other C-language modules. */
1810#define DEFUN static DEFINE_FUNC
1811#define DEFUE extern DEFINE_FUNC
1812#define DEFINE_FUNC(lname, fnname, sname, minargs, maxargs, intspec, doc) \
1809 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 1813 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1810 DECL_ALIGN (struct Lisp_Subr, sname) = \ 1814 DECL_ALIGN (struct Lisp_Subr, sname) = \
1811 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ 1815 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
@@ -2279,6 +2283,8 @@ void staticpro (Lisp_Object *);
2279 appropriate prototype. */ 2283 appropriate prototype. */
2280#define EXFUN(fnname, maxargs) \ 2284#define EXFUN(fnname, maxargs) \
2281 extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs 2285 extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs
2286#define INFUN(fnname, maxargs) \
2287 static Lisp_Object fnname DEFUN_ARGS_ ## maxargs
2282 2288
2283/* Forward declarations for prototypes. */ 2289/* Forward declarations for prototypes. */
2284struct window; 2290struct window;
@@ -2404,7 +2410,6 @@ extern void init_coding_once (void);
2404extern void syms_of_coding (void); 2410extern void syms_of_coding (void);
2405 2411
2406/* Defined in character.c */ 2412/* Defined in character.c */
2407EXFUN (Funibyte_char_to_multibyte, 1);
2408EXFUN (Fchar_width, 1); 2413EXFUN (Fchar_width, 1);
2409EXFUN (Fstring, MANY); 2414EXFUN (Fstring, MANY);
2410extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT); 2415extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT);
@@ -2428,7 +2433,6 @@ extern void syms_of_composite (void);
2428EXFUN (Fforward_word, 1); 2433EXFUN (Fforward_word, 1);
2429EXFUN (Fskip_chars_forward, 2); 2434EXFUN (Fskip_chars_forward, 2);
2430EXFUN (Fskip_chars_backward, 2); 2435EXFUN (Fskip_chars_backward, 2);
2431EXFUN (Fsyntax_table_p, 1);
2432extern void init_syntax_once (void); 2436extern void init_syntax_once (void);
2433extern void syms_of_syntax (void); 2437extern void syms_of_syntax (void);
2434 2438
@@ -2529,7 +2533,6 @@ extern void init_fringe_once (void);
2529extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; 2533extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
2530extern Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; 2534extern Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
2531extern Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; 2535extern Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
2532EXFUN (Finit_image_library, 2);
2533extern int x_bitmap_mask (struct frame *, int); 2536extern int x_bitmap_mask (struct frame *, int);
2534extern void syms_of_image (void); 2537extern void syms_of_image (void);
2535extern void init_image (void); 2538extern void init_image (void);
@@ -2790,11 +2793,11 @@ EXFUN (Fread, 1);
2790EXFUN (Fread_from_string, 3); 2793EXFUN (Fread_from_string, 3);
2791EXFUN (Fintern, 2); 2794EXFUN (Fintern, 2);
2792EXFUN (Fintern_soft, 2); 2795EXFUN (Fintern_soft, 2);
2796EXFUN (Funintern, 2);
2793EXFUN (Fload, 5); 2797EXFUN (Fload, 5);
2794EXFUN (Fget_load_suffixes, 0); 2798EXFUN (Fget_load_suffixes, 0);
2795EXFUN (Fread_char, 3); 2799EXFUN (Fread_char, 3);
2796EXFUN (Fread_event, 3); 2800EXFUN (Fread_event, 3);
2797EXFUN (Feval_region, 4);
2798extern Lisp_Object check_obarray (Lisp_Object); 2801extern Lisp_Object check_obarray (Lisp_Object);
2799extern Lisp_Object intern (const char *); 2802extern Lisp_Object intern (const char *);
2800extern Lisp_Object intern_c_string (const char *); 2803extern Lisp_Object intern_c_string (const char *);
@@ -2852,7 +2855,6 @@ EXFUN (Feval, 2);
2852extern Lisp_Object eval_sub (Lisp_Object form); 2855extern Lisp_Object eval_sub (Lisp_Object form);
2853EXFUN (Fapply, MANY); 2856EXFUN (Fapply, MANY);
2854EXFUN (Ffuncall, MANY); 2857EXFUN (Ffuncall, MANY);
2855EXFUN (Fbacktrace, 0);
2856extern Lisp_Object apply1 (Lisp_Object, Lisp_Object); 2858extern Lisp_Object apply1 (Lisp_Object, Lisp_Object);
2857extern Lisp_Object call0 (Lisp_Object); 2859extern Lisp_Object call0 (Lisp_Object);
2858extern Lisp_Object call1 (Lisp_Object, Lisp_Object); 2860extern Lisp_Object call1 (Lisp_Object, Lisp_Object);
@@ -2877,7 +2879,6 @@ extern void verror (const char *, va_list)
2877 NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); 2879 NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
2878extern void do_autoload (Lisp_Object, Lisp_Object); 2880extern void do_autoload (Lisp_Object, Lisp_Object);
2879extern Lisp_Object un_autoload (Lisp_Object); 2881extern Lisp_Object un_autoload (Lisp_Object);
2880EXFUN (Ffetch_bytecode, 1);
2881extern void init_eval_once (void); 2882extern void init_eval_once (void);
2882extern Lisp_Object safe_call (size_t, Lisp_Object *); 2883extern Lisp_Object safe_call (size_t, Lisp_Object *);
2883extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); 2884extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
@@ -2921,6 +2922,7 @@ EXFUN (Fwiden, 0);
2921EXFUN (Fuser_login_name, 1); 2922EXFUN (Fuser_login_name, 1);
2922EXFUN (Fsystem_name, 0); 2923EXFUN (Fsystem_name, 0);
2923EXFUN (Fcurrent_time, 0); 2924EXFUN (Fcurrent_time, 0);
2925EXFUN (Fget_internal_run_time, 0);
2924extern EMACS_INT clip_to_bounds (EMACS_INT, EMACS_INT, EMACS_INT); 2926extern EMACS_INT clip_to_bounds (EMACS_INT, EMACS_INT, EMACS_INT);
2925extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); 2927extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int);
2926extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, 2928extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT,
@@ -2953,7 +2955,6 @@ EXFUN (Fset_buffer, 1);
2953extern Lisp_Object set_buffer_if_live (Lisp_Object); 2955extern Lisp_Object set_buffer_if_live (Lisp_Object);
2954EXFUN (Fbarf_if_buffer_read_only, 0); 2956EXFUN (Fbarf_if_buffer_read_only, 0);
2955EXFUN (Fcurrent_buffer, 0); 2957EXFUN (Fcurrent_buffer, 0);
2956EXFUN (Fswitch_to_buffer, 2);
2957EXFUN (Fother_buffer, 3); 2958EXFUN (Fother_buffer, 3);
2958EXFUN (Foverlay_get, 2); 2959EXFUN (Foverlay_get, 2);
2959EXFUN (Fbuffer_modified_p, 1); 2960EXFUN (Fbuffer_modified_p, 1);
@@ -3018,7 +3019,6 @@ EXFUN (Funhandled_file_name_directory, 1);
3018EXFUN (Ffile_directory_p, 1); 3019EXFUN (Ffile_directory_p, 1);
3019EXFUN (Fwrite_region, 7); 3020EXFUN (Fwrite_region, 7);
3020EXFUN (Ffile_readable_p, 1); 3021EXFUN (Ffile_readable_p, 1);
3021EXFUN (Ffile_executable_p, 1);
3022EXFUN (Fread_file_name, 6); 3022EXFUN (Fread_file_name, 6);
3023extern Lisp_Object close_file_unwind (Lisp_Object); 3023extern Lisp_Object close_file_unwind (Lisp_Object);
3024extern Lisp_Object restore_point_unwind (Lisp_Object); 3024extern Lisp_Object restore_point_unwind (Lisp_Object);
@@ -3026,7 +3026,6 @@ extern void report_file_error (const char *, Lisp_Object) NO_RETURN;
3026extern int internal_delete_file (Lisp_Object); 3026extern int internal_delete_file (Lisp_Object);
3027extern void syms_of_fileio (void); 3027extern void syms_of_fileio (void);
3028extern Lisp_Object make_temp_name (Lisp_Object, int); 3028extern Lisp_Object make_temp_name (Lisp_Object, int);
3029EXFUN (Fmake_symbolic_link, 3);
3030extern Lisp_Object Qdelete_file; 3029extern Lisp_Object Qdelete_file;
3031 3030
3032/* Defined in abbrev.c */ 3031/* Defined in abbrev.c */
@@ -3119,7 +3118,6 @@ extern int input_pending;
3119EXFUN (Fdiscard_input, 0); 3118EXFUN (Fdiscard_input, 0);
3120EXFUN (Frecursive_edit, 0); 3119EXFUN (Frecursive_edit, 0);
3121EXFUN (Ftop_level, 0) NO_RETURN; 3120EXFUN (Ftop_level, 0) NO_RETURN;
3122EXFUN (Fcommand_execute, 4);
3123extern Lisp_Object menu_bar_items (Lisp_Object); 3121extern Lisp_Object menu_bar_items (Lisp_Object);
3124extern Lisp_Object tool_bar_items (Lisp_Object, int *); 3122extern Lisp_Object tool_bar_items (Lisp_Object, int *);
3125extern Lisp_Object Qvertical_scroll_bar; 3123extern Lisp_Object Qvertical_scroll_bar;
@@ -3221,7 +3219,6 @@ extern int running_asynch_code;
3221 3219
3222/* Defined in process.c */ 3220/* Defined in process.c */
3223extern Lisp_Object QCtype, Qlocal; 3221extern Lisp_Object QCtype, Qlocal;
3224EXFUN (Fget_process, 1);
3225EXFUN (Fget_buffer_process, 1); 3222EXFUN (Fget_buffer_process, 1);
3226EXFUN (Fprocess_status, 1); 3223EXFUN (Fprocess_status, 1);
3227EXFUN (Fkill_process, 2); 3224EXFUN (Fkill_process, 2);
@@ -3255,7 +3252,6 @@ extern void syms_of_callproc (void);
3255/* Defined in doc.c */ 3252/* Defined in doc.c */
3256extern Lisp_Object Qfunction_documentation; 3253extern Lisp_Object Qfunction_documentation;
3257EXFUN (Fsubstitute_command_keys, 1); 3254EXFUN (Fsubstitute_command_keys, 1);
3258EXFUN (Fdocumentation_property, 3);
3259extern Lisp_Object read_doc_string (Lisp_Object); 3255extern Lisp_Object read_doc_string (Lisp_Object);
3260extern Lisp_Object get_doc_string (Lisp_Object, int, int); 3256extern Lisp_Object get_doc_string (Lisp_Object, int, int);
3261extern void syms_of_doc (void); 3257extern void syms_of_doc (void);
@@ -3263,7 +3259,6 @@ extern int read_bytecode_char (int);
3263 3259
3264/* Defined in bytecode.c */ 3260/* Defined in bytecode.c */
3265extern Lisp_Object Qbytecode; 3261extern Lisp_Object Qbytecode;
3266EXFUN (Fbyte_code, 3);
3267extern void syms_of_bytecode (void); 3262extern void syms_of_bytecode (void);
3268extern struct byte_stack *byte_stack_list; 3263extern struct byte_stack *byte_stack_list;
3269#ifdef BYTE_MARK_STACK 3264#ifdef BYTE_MARK_STACK
@@ -3384,7 +3379,6 @@ extern void syms_of_category (void);
3384extern void syms_of_ccl (void); 3379extern void syms_of_ccl (void);
3385 3380
3386/* Defined in dired.c */ 3381/* Defined in dired.c */
3387EXFUN (Ffile_attributes, 2);
3388extern void syms_of_dired (void); 3382extern void syms_of_dired (void);
3389extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, 3383extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
3390 Lisp_Object, Lisp_Object, 3384 Lisp_Object, Lisp_Object,