From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: Is INLINE_HEADER_BEGIN still useful? Date: Wed, 29 Apr 2015 13:21:59 +0200 Message-ID: <87h9rzb2nc.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1430306889 4328 80.91.229.3 (29 Apr 2015 11:28:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2015 11:28:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 29 13:28:03 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YnQ9p-0002KP-Rw for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2015 13:28:02 +0200 Original-Received: from localhost ([::1]:38280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnQ9p-0007Nn-4I for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2015 07:28:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnQ9k-0007Kv-4i for emacs-devel@gnu.org; Wed, 29 Apr 2015 07:27:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnQ9g-0004aD-S7 for emacs-devel@gnu.org; Wed, 29 Apr 2015 07:27:56 -0400 Original-Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:36587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnQ9g-0004a3-HG for emacs-devel@gnu.org; Wed, 29 Apr 2015 07:27:52 -0400 Original-Received: by wizk4 with SMTP id k4so176006687wiz.1 for ; Wed, 29 Apr 2015 04:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=k0ZhzjkJ13llxpqWcfX2Fx6RxC96X3NQwFwMw1cYLQQ=; b=u4RTTTqkvuJOijNXwGqM1c7ru3nSATkKB7JncbZpiHvMMkN9kteyIB6I9QV+pXX8KO xQuGBzdxi88yLYI3d1bXYnupG0RAbVaGsVAK2/lIkO4f1JWRyixpHu3XbbouoDXoIuTl SulEODgNYKXqYk6FoyLIoF2Fa360AReNdSpoZdlBZbM+fldmoiat4Wmf28ZXkSjxa2uD VVWroq5l12gjKn/aV+nyBYSXILN6Y8J1tJRQIytU0Vs7c9rUJmD2YP6xXjFW42k1jAPm 5puQslzHE3/UG6/1vv/lByWB+fmI4fOTzY6OWr8m8D3ngi5wCDqGX0vAg/gT+dTXZBAe 5G1g== X-Received: by 10.194.187.16 with SMTP id fo16mr42219612wjc.86.1430306871674; Wed, 29 Apr 2015 04:27:51 -0700 (PDT) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id ex5sm20785181wib.2.2015.04.29.04.27.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 29 Apr 2015 04:27:50 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186003 Archived-At: --=-=-= Content-Type: text/plain Hi all, This macro, encountered in most headers, seems to work around some compilers not supporting C99. A quick internet search shows that no other software except Emacs uses this (any more, I assume some did in the past). Is it still useful? If not, it unnecessarily complicates the header structure and should be removed. I attach an example patch for only buffer.h that compiles and works well. Also, what's the stance on C11? I don't know a lot of C outside of what C++ includes, but I'm considering to learn more of it just for Emacs. Is C11 encouraged / allowed / discouraged / disallowed? I assume that C99 is at least allowed since #17487. Is it encouraged? In that case, surely INLINE_HEADER_BEGIN should be removed. Oleh --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Remove-INLINE_HEADER_BEGIN-in-buffer.h.patch >From 6da130ba276a9c7f0f13b5993cace8f943cb7334 Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Wed, 29 Apr 2015 13:11:18 +0200 Subject: [PATCH] Remove INLINE_HEADER_BEGIN in buffer.h --- src/buffer.h | 80 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/src/buffer.h b/src/buffer.h index a0410d4..0a72154 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -21,8 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include -INLINE_HEADER_BEGIN - /* Accessing the parameters of the current buffer. */ /* These macros come in pairs, one for the char position @@ -878,102 +876,102 @@ struct buffer /* Most code should use these functions to set Lisp fields in struct buffer. (Some setters that are private to a single .c file are defined as static in those files.) */ -INLINE void +inline void bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) { b->bidi_paragraph_direction_ = val; } -INLINE void +inline void bset_cache_long_scans (struct buffer *b, Lisp_Object val) { b->cache_long_scans_ = val; } -INLINE void +inline void bset_case_canon_table (struct buffer *b, Lisp_Object val) { b->case_canon_table_ = val; } -INLINE void +inline void bset_case_eqv_table (struct buffer *b, Lisp_Object val) { b->case_eqv_table_ = val; } -INLINE void +inline void bset_directory (struct buffer *b, Lisp_Object val) { b->directory_ = val; } -INLINE void +inline void bset_display_count (struct buffer *b, Lisp_Object val) { b->display_count_ = val; } -INLINE void +inline void bset_display_time (struct buffer *b, Lisp_Object val) { b->display_time_ = val; } -INLINE void +inline void bset_downcase_table (struct buffer *b, Lisp_Object val) { b->downcase_table_ = val; } -INLINE void +inline void bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val) { b->enable_multibyte_characters_ = val; } -INLINE void +inline void bset_filename (struct buffer *b, Lisp_Object val) { b->filename_ = val; } -INLINE void +inline void bset_keymap (struct buffer *b, Lisp_Object val) { b->keymap_ = val; } -INLINE void +inline void bset_last_selected_window (struct buffer *b, Lisp_Object val) { b->last_selected_window_ = val; } -INLINE void +inline void bset_local_var_alist (struct buffer *b, Lisp_Object val) { b->local_var_alist_ = val; } -INLINE void +inline void bset_mark_active (struct buffer *b, Lisp_Object val) { b->mark_active_ = val; } -INLINE void +inline void bset_point_before_scroll (struct buffer *b, Lisp_Object val) { b->point_before_scroll_ = val; } -INLINE void +inline void bset_read_only (struct buffer *b, Lisp_Object val) { b->read_only_ = val; } -INLINE void +inline void bset_truncate_lines (struct buffer *b, Lisp_Object val) { b->truncate_lines_ = val; } -INLINE void +inline void bset_undo_list (struct buffer *b, Lisp_Object val) { b->undo_list_ = val; } -INLINE void +inline void bset_upcase_table (struct buffer *b, Lisp_Object val) { b->upcase_table_ = val; } -INLINE void +inline void bset_width_table (struct buffer *b, Lisp_Object val) { b->width_table_ = val; @@ -1090,7 +1088,7 @@ extern void set_buffer_if_live (Lisp_Object); /* Return B as a struct buffer pointer, defaulting to the current buffer. */ -INLINE struct buffer * +inline struct buffer * decode_buffer (Lisp_Object b) { return NILP (b) ? current_buffer : (CHECK_BUFFER (b), XBUFFER (b)); @@ -1105,7 +1103,7 @@ decode_buffer (Lisp_Object b) windows than the selected one requires a select_window at some time, and that increments windows_or_buffers_changed. */ -INLINE void +inline void set_buffer_internal (struct buffer *b) { if (current_buffer != b) @@ -1115,7 +1113,7 @@ set_buffer_internal (struct buffer *b) /* Arrange to go back to the original buffer after the next call to unbind_to if the original buffer is still alive. */ -INLINE void +inline void record_unwind_current_buffer (void) { record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); @@ -1150,7 +1148,7 @@ extern Lisp_Object Vbuffer_alist; /* Get text properties of B. */ -INLINE INTERVAL +inline INTERVAL buffer_intervals (struct buffer *b) { eassert (b->text != NULL); @@ -1159,7 +1157,7 @@ buffer_intervals (struct buffer *b) /* Set text properties of B to I. */ -INLINE void +inline void set_buffer_intervals (struct buffer *b, INTERVAL i) { eassert (b->text != NULL); @@ -1168,7 +1166,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i) /* Non-zero if current buffer has overlays. */ -INLINE bool +inline bool buffer_has_overlays (void) { return current_buffer->overlays_before || current_buffer->overlays_after; @@ -1188,7 +1186,7 @@ buffer_has_overlays (void) the buffer to the next character after fetching this one. Instead, use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH. */ -INLINE int +inline int FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) { unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0) @@ -1200,7 +1198,7 @@ FETCH_MULTIBYTE_CHAR (ptrdiff_t pos) If POS doesn't point the head of valid multi-byte form, only the byte at POS is returned. No range checking. */ -INLINE int +inline int BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) { unsigned char *p @@ -1211,7 +1209,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) /* Return number of windows showing B. */ -INLINE int +inline int buffer_window_count (struct buffer *b) { if (b->base_buffer) @@ -1318,13 +1316,13 @@ extern int last_per_buffer_idx; /* Functions to get and set default value of the per-buffer variable at offset OFFSET in the buffer structure. */ -INLINE Lisp_Object +inline Lisp_Object per_buffer_default (int offset) { return *(Lisp_Object *)(offset + (char *) &buffer_defaults); } -INLINE void +inline void set_per_buffer_default (int offset, Lisp_Object value) { *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value; @@ -1333,20 +1331,20 @@ set_per_buffer_default (int offset, Lisp_Object value) /* Functions to get and set buffer-local value of the per-buffer variable at offset OFFSET in the buffer structure. */ -INLINE Lisp_Object +inline Lisp_Object per_buffer_value (struct buffer *b, int offset) { return *(Lisp_Object *)(offset + (char *) b); } -INLINE void +inline void set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value) { *(Lisp_Object *)(offset + (char *) b) = value; } /* Downcase a character C, or make no change if that cannot be done. */ -INLINE int +inline int downcase (int c) { Lisp_Object downcase_table = BVAR (current_buffer, downcase_table); @@ -1355,10 +1353,10 @@ downcase (int c) } /* True if C is upper case. */ -INLINE bool uppercasep (int c) { return downcase (c) != c; } +inline bool uppercasep (int c) { return downcase (c) != c; } /* Upcase a character C known to be not upper case. */ -INLINE int +inline int upcase1 (int c) { Lisp_Object upcase_table = BVAR (current_buffer, upcase_table); @@ -1367,13 +1365,11 @@ upcase1 (int c) } /* True if C is lower case. */ -INLINE bool +inline bool lowercasep (int c) { return !uppercasep (c) && upcase1 (c) != c; } /* Upcase a character C, or make no change if that cannot be done. */ -INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } - -INLINE_HEADER_END +inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); } -- 1.8.4 --=-=-=--