diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 6243f666955..d0ea463f299 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -577,7 +577,13 @@ struct global }; /* Bit values for FLAGS field from the above. Applied for DEFUNs only. */ -enum { DEFUN_noreturn = 1, DEFUN_const = 2, DEFUN_noinline = 4 }; +enum + { + DEFUN_noreturn = 1, + DEFUN_const = 2, + DEFUN_noinline = 4, + DEFUN_pure = 8, + }; /* All the variable names we saw while scanning C sources in `-g' mode. */ @@ -752,6 +758,8 @@ write_globals (void) fputs (" ATTRIBUTE_COLD", stdout); if (globals[i].flags & DEFUN_const) fputs (" ATTRIBUTE_CONST", stdout); + if (globals[i].flags & DEFUN_pure) + fputs (" ATTRIBUTE_PURE", stdout); puts (";"); } @@ -1062,7 +1070,7 @@ scan_c_stream (FILE *infile) attributes: attribute1 attribute2 ...) (Lisp_Object arg...) - Now only `const', `noinline' and `noreturn' attributes + Now only 'const', 'noinline', 'noreturn', and 'pure' attributes are used. */ /* Advance to the end of docstring. */ @@ -1110,6 +1118,8 @@ scan_c_stream (FILE *infile) g->flags |= DEFUN_noreturn; if (strstr (input_buffer, "const")) g->flags |= DEFUN_const; + if (strstr (input_buffer, "pure")) + g->flags |= DEFUN_pure; /* Although the noinline attribute is no longer used, leave its support in, in case it's needed later. */ diff --git a/src/bignum.h b/src/bignum.h index 5693aae148a..132fa31f0f5 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -56,7 +56,7 @@ extern void emacs_mpz_mul_2exp (mpz_t, mpz_t const, EMACS_INT) ARG_NONNULL ((1, 2)); extern void emacs_mpz_pow_ui (mpz_t, mpz_t const, unsigned long) ARG_NONNULL ((1, 2)); -extern double mpz_get_d_rounded (mpz_t const) ATTRIBUTE_CONST; +extern double mpz_get_d_rounded (mpz_t const) ATTRIBUTE_PURE; extern Lisp_Object get_random_bignum (struct Lisp_Bignum const *); INLINE_HEADER_BEGIN diff --git a/src/data.c b/src/data.c index 333d908aedc..c619b8eb4ef 100644 --- a/src/data.c +++ b/src/data.c @@ -166,8 +166,7 @@ slow_eq (Lisp_Object x, Lisp_Object y) } DEFUN ("eq", Feq, Seq, 2, 2, 0, - doc: /* Return t if the two args are the same Lisp object. */ - attributes: const) + doc: /* Return t if the two args are the same Lisp object. */) (Lisp_Object obj1, Lisp_Object obj2) { if (EQ (obj1, obj2)) @@ -373,7 +372,7 @@ Ignore `symbols-with-pos-enabled'. */ DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0, doc: /* Return t if OBJECT is a symbol. */ - attributes: const) + attributes: pure) (Lisp_Object object) { if (SYMBOLP (object)) @@ -551,7 +550,7 @@ DEFUN ("interpreted-function-p", Finterpreted_function_p, DEFUN ("module-function-p", Fmodule_function_p, Smodule_function_p, 1, 1, NULL, doc: /* Return t if OBJECT is a function loaded from a dynamic module. */ - attributes: const) + attributes: pure) (Lisp_Object object) { return MODULE_FUNCTIONP (object) ? Qt : Qnil; @@ -569,7 +568,7 @@ DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0, doc: /* Return t if OBJECT is an integer. */ - attributes: const) + attributes: pure) (Lisp_Object object) { if (INTEGERP (object)) @@ -598,7 +597,7 @@ DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0, DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0, doc: /* Return t if OBJECT is a number (floating point or integer). */ - attributes: const) + attributes: pure) (Lisp_Object object) { if (NUMBERP (object)) diff --git a/src/lisp.h b/src/lisp.h index eb1aa437dba..fe8e2aaea72 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -619,7 +619,7 @@ INLINE void set_sub_char_table_contents (Lisp_Object, ptrdiff_t, /* Defined in bignum.c. */ extern int check_int_nonnegative (Lisp_Object); extern intmax_t check_integer_range (Lisp_Object, intmax_t, intmax_t); -extern double bignum_to_double (Lisp_Object) ATTRIBUTE_CONST; +extern double bignum_to_double (Lisp_Object) ATTRIBUTE_PURE; extern Lisp_Object make_bigint (intmax_t); extern Lisp_Object make_biguint (uintmax_t); extern uintmax_t check_uinteger_max (Lisp_Object, uintmax_t); @@ -4105,9 +4105,9 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) /* Defined in bignum.c. This part of bignum.c's API does not require the caller to access bignum internals; see bignum.h for that. */ -extern intmax_t bignum_to_intmax (Lisp_Object) ATTRIBUTE_CONST; -extern uintmax_t bignum_to_uintmax (Lisp_Object) ATTRIBUTE_CONST; -extern ptrdiff_t bignum_bufsize (Lisp_Object, int) ATTRIBUTE_CONST; +extern intmax_t bignum_to_intmax (Lisp_Object) ATTRIBUTE_PURE; +extern uintmax_t bignum_to_uintmax (Lisp_Object) ATTRIBUTE_PURE; +extern ptrdiff_t bignum_bufsize (Lisp_Object, int) ATTRIBUTE_PURE; extern ptrdiff_t bignum_to_c_string (char *, ptrdiff_t, Lisp_Object, int); extern Lisp_Object bignum_to_string (Lisp_Object, int); extern Lisp_Object make_bignum_str (char const *, int); diff --git a/src/pdumper.h b/src/pdumper.h index fa402942e98..7ec04da5494 100644 --- a/src/pdumper.h +++ b/src/pdumper.h @@ -158,7 +158,7 @@ extern struct pdumper_loaded_dump dump_public; /* Return whether the OBJ points somewhere into the loaded dump image. Works even when we have no dump loaded --- in this case, it just returns false. */ -INLINE _GL_ATTRIBUTE_CONST bool +INLINE bool pdumper_object_p (const void *obj) { #ifdef HAVE_PDUMPER @@ -176,7 +176,7 @@ extern bool pdumper_cold_object_p_impl (const void *obj); Only bool-vectors and floats should end up there. pdumper_object_p() and pdumper_object_p_precise() must have returned true for OBJ before calling this function. */ -INLINE _GL_ATTRIBUTE_CONST bool +INLINE bool pdumper_cold_object_p (const void *obj) { #ifdef HAVE_PDUMPER @@ -193,7 +193,7 @@ extern int pdumper_find_object_type_impl (const void *obj); /* Return the type of the dumped object that starts at OBJ. It is a programming error to call this routine for an OBJ for which pdumper_object_p would return false. */ -INLINE _GL_ATTRIBUTE_CONST int +INLINE int pdumper_find_object_type (const void *obj) { #ifdef HAVE_PDUMPER @@ -216,7 +216,7 @@ pdumper_valid_object_type_p (int type) the loaded dump image. It is a programming error to call this routine for an OBJ for which pdumper_object_p would return false. */ -INLINE _GL_ATTRIBUTE_CONST bool +INLINE bool pdumper_object_p_precise (const void *obj) { #ifdef HAVE_PDUMPER diff --git a/src/xfaces.c b/src/xfaces.c index 6189337ff68..83d4c3f1f2c 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4194,8 +4194,7 @@ with the value VALUE is relative. A relative value is one that doesn't entirely override whatever is inherited from another face. For most possible attributes, the only relative value that users see is `unspecified'. -However, for :height, floating point values are also relative. */ - attributes: const) +However, for :height, floating point values are also relative. */) (Lisp_Object attribute, Lisp_Object value) { if (EQ (value, Qunspecified) || (EQ (value, QCignore_defface)))