+2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ Add GCC-style 'const' attribute to functions that can use it.
+ * configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const.
+ (ATTRIBUTE_CONST): New macro, in config.h.
+
2012-07-09 Juanma Barranquero <lekktu@gmail.com>
* lib/makefile.w32-in: Rework dependencies.
# The following lines should be removable at some point.
nw="$nw -Wstack-protector"
nw="$nw -Wstrict-overflow"
- nw="$nw -Wsuggest-attribute=const"
nw="$nw -Wsuggest-attribute=pure"
gl_MANYWARN_ALL_GCC([ws])
ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
#endif
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
/* Some versions of GNU/Linux define noinline in their headers. */
#ifdef noinline
#undef noinline
+2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ Add GCC-style 'const' attribute to functions that can use it.
+ * etags.c (number_len): Add ATTRIBUTE_CONST.
+
2012-07-09 Juanma Barranquero <lekktu@gmail.com>
* emacsclient.c (w32_execvp): Declare execvp to silence the compiler.
\f
static int total_size_of_entries (node *);
-static int number_len (long);
+static int number_len (long) ATTRIBUTE_CONST;
/* Length of a non-negative number's decimal representation. */
static int
+2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ * config.nt (ATTRIBUTE_CONST): Add, to sync with configure.ac.
+
2012-07-09 Juanma Barranquero <lekktu@gmail.com>
* config.nt: Sync with autogen/config.in.
ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
#endif
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
/* Some versions of GNU/Linux define noinline in their headers. */
#ifdef noinline
#undef noinline
2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
+ Add GCC-style 'const' attribute to functions that can use it.
+ * character.h (char_resolve_modifier_mask):
+ * keyboard.h (make_ctrl_char):
+ * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe)
+ (init_character_once, next_almost_prime, init_fns, init_image)
+ (flush_pending_output, init_sound):
+ * mem-limits.h (start_of_data):
+ * menu.h (finish_menu_items):
+ Add ATTRIBUTE_CONST.
+ * emacs.c (DEFINE_DUMMY_FUNCTION):
+ Declare the dummy function with ATTRIBUTE_CONST.
+ * lisp.h (Fbyteorder, Fmax_char, Fidentity):
+ Add decls with ATTRIBUTE_CONST.
+
Minor improvements to make_formatted_string.
* alloc.c (make_formatted_string): Prefer int to ptrdiff_t
where int is good enough, as vsprintf returns an int.
UNICODE_CATEGORY_Cn
} unicode_category_t;
-extern EMACS_INT char_resolve_modifier_mask (EMACS_INT);
+extern EMACS_INT char_resolve_modifier_mask (EMACS_INT) ATTRIBUTE_CONST;
extern int char_string (unsigned, unsigned char *);
extern int string_char (const unsigned char *,
const unsigned char **, int *);
/* Define a dummy function F. Declare F too, to pacify gcc
-Wmissing-prototypes. */
#define DEFINE_DUMMY_FUNCTION(f) \
- void f (void) EXTERNALLY_VISIBLE; void f (void) {}
+ void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
#ifndef GCC_CTORS_IN_LIBC
DEFINE_DUMMY_FUNCTION (__do_global_ctors)
extern void clear_input_pending (void);
extern int requeued_events_pending_p (void);
extern void bind_polling_period (int);
-extern int make_ctrl_char (int);
+extern int make_ctrl_char (int) ATTRIBUTE_CONST;
extern void stuff_buffered_input (Lisp_Object);
extern void clear_waiting_for_input (void);
extern void swallow_events (int);
extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
+EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
+
/* Defined in frame.c */
extern Lisp_Object Qframep;
extern void syms_of_coding (void);
/* Defined in character.c */
+EXFUN (Fmax_char, 0) ATTRIBUTE_CONST;
extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
-extern int multibyte_char_to_unibyte (int);
-extern int multibyte_char_to_unibyte_safe (int);
-extern void init_character_once (void);
+extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST;
+extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST;
+extern void init_character_once (void) ATTRIBUTE_CONST;
extern void syms_of_character (void);
/* Defined in charset.c */
/* Defined in fns.c */
extern Lisp_Object QCrehash_size, QCrehash_threshold;
enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
-extern EMACS_INT next_almost_prime (EMACS_INT);
+EXFUN (Fidentity, 1) ATTRIBUTE_CONST;
+extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST;
extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t);
extern void sweep_weak_hash_tables (void);
extern Lisp_Object Qcursor_in_echo_area;
ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
EMACS_UINT);
void init_weak_hash_tables (void);
-extern void init_fns (void);
+extern void init_fns (void) ATTRIBUTE_CONST;
extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t);
extern Lisp_Object QCconversion;
extern int x_bitmap_mask (struct frame *, ptrdiff_t);
extern void syms_of_image (void);
-extern void init_image (void);
+extern void init_image (void) ATTRIBUTE_CONST;
/* Defined in insdel.c */
extern Lisp_Object Qinhibit_modification_hooks;
extern void reset_all_sys_modes (void);
extern void wait_for_termination (pid_t);
extern void interruptible_wait_for_termination (pid_t);
-extern void flush_pending_output (int);
+extern void flush_pending_output (int) ATTRIBUTE_CONST;
extern void child_setup_tty (int);
extern void setup_pty (int);
extern int set_window_size (int, int, int);
/* Defined in sound.c */
extern void syms_of_sound (void);
-extern void init_sound (void);
+extern void init_sound (void) ATTRIBUTE_CONST;
/* Defined in category.c */
extern void init_category_once (void);
# endif
#endif
-extern char *start_of_data (void);
+extern char *start_of_data (void) ATTRIBUTE_CONST;
#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
#define EXCEEDS_LISP_PTR(ptr) 0
#elif defined DATA_SEG_BITS
Lisp_Object oldval);
extern void init_menu_items (void);
-extern void finish_menu_items (void);
+extern void finish_menu_items (void) ATTRIBUTE_CONST;
extern void discard_menu_items (void);
extern void save_menu_items (void);
extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);