all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Fix build error in terminal.c on FreeBSD
@ 2015-09-13 17:48 Ashish SHUKLA
  2015-09-13 18:59 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Ashish SHUKLA @ 2015-09-13 17:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: Paul Eggert


[-- Attachment #1.1: Type: text/plain, Size: 2458 bytes --]

Hi,

On FreeBSD (and pretty sure other non-GNU/Linux platforms) with svgalib port
(which provides stub <linux/kd.h>) installed, I get following error with emacs
HEAD (commit: 6514b30e6):

--8<---------------cut here---------------start------------->8---
  CC       terminal.o
terminal.c:545:32: error: array has incomplete element type 'struct unipair'
  struct unipair unipair_buffer[initial_unipairs];
                               ^
terminal.c:545:10: note: forward declaration of 'struct unipair'
  struct unipair unipair_buffer[initial_unipairs];
         ^
terminal.c:552:25: error: variable has incomplete type 'struct unimapdesc'
      struct unimapdesc unimapdesc = { entry_ct, entries };
                        ^
terminal.c:552:14: note: forward declaration of 'struct unimapdesc'
      struct unimapdesc unimapdesc = { entry_ct, entries };
             ^
terminal.c:553:22: error: use of undeclared identifier 'GIO_UNIMAP'; did you mean 'GDK_UNMAP'?
      if (ioctl (fd, GIO_UNIMAP, &unimapdesc) == 0)
                     ^~~~~~~~~~
                     GDK_UNMAP
/usr/local/include/gtk-3.0/gdk/gdkevents.h:309:3: note: 'GDK_UNMAP' declared here
  GDK_UNMAP             = 15,
  ^
terminal.c:557:39: error: subscript of pointer to incomplete type 'struct unipair'
            char_table_set (glyphtab, entries[i].unicode,
                                      ~~~~~~~^
terminal.c:545:10: note: forward declaration of 'struct unipair'
  struct unipair unipair_buffer[initial_unipairs];
         ^
terminal.c:564:64: error: invalid application of 'sizeof' to an incomplete type 'struct unipair'
      entries = alloced = xrealloc (alloced, entry_ct * sizeof *alloced);
                                                               ^~~~~~~~
terminal.c:545:10: note: forward declaration of 'struct unipair'
  struct unipair unipair_buffer[initial_unipairs];
         ^
5 errors generated.
Makefile:363: recipe for target 'terminal.o' failed
gmake[3]: *** [terminal.o] Error 1
--8<---------------cut here---------------end--------------->8---

This seems to have come from commit 6e5d81ff4 (cc'ed author). A probable fix
is attached.

Also, if you don't mind could you please Cc me on replies, as I've delivery
disabled in list subscription.

Thanks!
-- 
Ashish SHUKLA

“Any priest or shaman must be presumed guilty until proved innocent.” (Robert
A. Heinlein, 1973)

Sent from my Emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: terminal.c.diff --]
[-- Type: text/x-patch, Size: 1010 bytes --]

diff --git a/src/terminal.c b/src/terminal.c
index d7c16d9..638c663 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -28,7 +28,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "keyboard.h"
 
-#ifdef HAVE_LINUX_KD_H
+#if (defined(__linux__) && defined(HAVE_LINUX_KD_H))
 # include <errno.h>
 # include <linux/kd.h>
 # include <sys/ioctl.h>
@@ -532,7 +532,7 @@ selected frame's terminal).  */)
   return store_terminal_param (decode_live_terminal (terminal), parameter, value);
 }
 
-#if HAVE_LINUX_KD_H
+#if (defined(__linux__) && defined(HAVE_LINUX_KD_H))
 
 /* Compute the glyph code table for T.  */
 
@@ -575,7 +575,7 @@ calculate_glyph_code_table (struct terminal *t)
 Lisp_Object
 terminal_glyph_code (struct terminal *t, int ch)
 {
-#if HAVE_LINUX_KD_H
+#if (defined(__linux__) && defined(HAVE_LINUX_KD_H))
   if (t->type == output_termcap)
     {
       /* As a hack, recompute the table when CH is the maximum

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix build error in terminal.c on FreeBSD
  2015-09-13 17:48 [PATCH] Fix build error in terminal.c on FreeBSD Ashish SHUKLA
@ 2015-09-13 18:59 ` Paul Eggert
  2015-09-13 20:32   ` Ashish SHUKLA
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2015-09-13 18:59 UTC (permalink / raw)
  To: Ashish SHUKLA, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Thanks for the heads-up.  I installed the attached patch instead, as that should 
be better if the Linux console emulation in FreeBSD ever adds support for 
Unicode characters.  Please give it a try.

[-- Attachment #2: 0001-Port-Unicode-char-detection-to-FreeBSD-svgalib.patch --]
[-- Type: text/plain, Size: 2119 bytes --]

From 4fa35ef03774367a7a776208f04d420af3506ab7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 13 Sep 2015 11:55:28 -0700
Subject: [PATCH] Port Unicode char detection to FreeBSD+svgalib
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Ashish SHUKLA in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00531.html
* configure.ac: Check for struct unipair.unicode instead of for
<linux/kd.h>, since that’s more specific to what the code actually needs.
* src/terminal.c: Use HAVE_STRUCT_UNIPAIR_UNICODE, not HAVE_LINUX_KD_H.
---
 configure.ac   | 3 ++-
 src/terminal.c | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index cd828de..f86d29e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1582,7 +1582,6 @@ fi
 
 dnl checks for header files
 AC_CHECK_HEADERS_ONCE(
-  linux/kd.h
   sys/systeminfo.h
   sys/sysinfo.h
   coff.h pty.h
@@ -3999,6 +3998,8 @@ AC_SUBST(KRB4LIB)
 
 AC_CHECK_HEADERS(valgrind/valgrind.h)
 
+AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
+
 AC_CHECK_FUNCS_ONCE(tzset)
 
 ok_so_far=yes
diff --git a/src/terminal.c b/src/terminal.c
index d7c16d9..80c6aa2 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -28,7 +28,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "keyboard.h"
 
-#ifdef HAVE_LINUX_KD_H
+#if HAVE_STRUCT_UNIPAIR_UNICODE
 # include <errno.h>
 # include <linux/kd.h>
 # include <sys/ioctl.h>
@@ -532,7 +532,7 @@ selected frame's terminal).  */)
   return store_terminal_param (decode_live_terminal (terminal), parameter, value);
 }
 
-#if HAVE_LINUX_KD_H
+#if HAVE_STRUCT_UNIPAIR_UNICODE
 
 /* Compute the glyph code table for T.  */
 
@@ -575,7 +575,7 @@ calculate_glyph_code_table (struct terminal *t)
 Lisp_Object
 terminal_glyph_code (struct terminal *t, int ch)
 {
-#if HAVE_LINUX_KD_H
+#if HAVE_STRUCT_UNIPAIR_UNICODE
   if (t->type == output_termcap)
     {
       /* As a hack, recompute the table when CH is the maximum
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix build error in terminal.c on FreeBSD
  2015-09-13 18:59 ` Paul Eggert
@ 2015-09-13 20:32   ` Ashish SHUKLA
  0 siblings, 0 replies; 3+ messages in thread
From: Ashish SHUKLA @ 2015-09-13 20:32 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Ashish SHUKLA, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

On Sun, 13 Sep 2015 11:59:13 -0700, Paul Eggert <eggert@cs.ucla.edu> said:
| Thanks for the heads-up.  I installed the attached patch instead, as
| that should be better if the Linux console emulation in FreeBSD ever
| adds support for Unicode characters.  Please give it a try.

Hi,

This fix seems better, and works.

Thank you!

-- 
Ashish SHUKLA

“I know what you're thinking -- "Did he fire six shots or only five?" Well, to
tell you the truth, in all the excitement, I kind of lost track myself.  But
being this is a .44 Magnum, the most powerful handgun in the world, and would
blow your head clean off, you've got to ask yourself one question: "Do I feel
lucky?"  Well, do you, punk?” (Harry Callahan, badge #2211)

Sent from my Emacs

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-13 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-13 17:48 [PATCH] Fix build error in terminal.c on FreeBSD Ashish SHUKLA
2015-09-13 18:59 ` Paul Eggert
2015-09-13 20:32   ` Ashish SHUKLA

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.