Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Robert Pluim
>>>>> On Mon, 13 May 2019 13:52:44 -0400 (EDT), [hidden email] (Alexander Gramiak) said:

    Alexander> branch: scratch/X_Typedefs
    Alexander> commit 09c65d6cfb1c873d9087576523878d55e185bdac
    Alexander> Author: Alexander Gramiak <[hidden email]>
    Alexander> Commit: Alexander Gramiak <[hidden email]>

    Alexander>     Introduce Emacs_GC struct and typedef
   
    Alexander>     * src/dispextern.h [HAVE_X_WINDOWS]: Alias Emacs_GC
    Alexander>     to XGCValues.

    In file included from dispnew.c:29:
    In file included from ./termchar.h:23:
    ./dispextern.h:1623:3: error: unknown type name 'GC'
      GC gc;
      ^

(this is on macOS)

Robert

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
Robert Pluim <[hidden email]> writes:

>>>>>> On Mon, 13 May 2019 13:52:44 -0400 (EDT), [hidden email] (Alexander Gramiak) said:
>
>     Alexander> branch: scratch/X_Typedefs
>     Alexander> commit 09c65d6cfb1c873d9087576523878d55e185bdac
>     Alexander> Author: Alexander Gramiak <[hidden email]>
>     Alexander> Commit: Alexander Gramiak <[hidden email]>
>
>     Alexander>     Introduce Emacs_GC struct and typedef
>    
>     Alexander>     * src/dispextern.h [HAVE_X_WINDOWS]: Alias Emacs_GC
>     Alexander>     to XGCValues.
>
>     In file included from dispnew.c:29:
>     In file included from ./termchar.h:23:
>     ./dispextern.h:1623:3: error: unknown type name 'GC'
>       GC gc;
>       ^
>
> (this is on macOS)
>
> Robert

Sorry, I pushed a fix for that.

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Robert Pluim
>>>>> On Tue, 14 May 2019 09:13:16 -0600, Alex Gramiak <[hidden email]> said:

    Alex> Sorry, I pushed a fix for that.

It gets a bit further now:

  CC       xfaces.o
xfaces.c:542:8: error: unknown type name 'GC'
static GC
       ^
xfaces.c:549:10: warning: incompatible pointer to integer conversion returning
      'Emacs_GC *' from a function with result type 'int' [-Wint-conversion]
  return gc;
         ^~
1 warning and 1 error generated.
make: *** [xfaces.o] Error 1
  CC       macfont.o
macfont.m:1662:19: warning: incompatible pointer types initializing 'void (*)(struct font
      *, const unsigned int *, int, struct font_metrics *)' with an expression of type
      'void (struct font *, unsigned int *, int, struct font_metrics *)'
      [-Wincompatible-pointer-types]
  .text_extents = macfont_text_extents,
                  ^~~~~~~~~~~~~~~~~~~~
macfont.m:2738:1: error: conflicting types for 'macfont_text_extents'
macfont_text_extents (struct font *font, const unsigned int *code, int nglyphs,
^
macfont.m:1642:13: note: previous declaration is here
static void macfont_text_extents (struct font *, unsigned int *, int,
            ^
macfont.m:2821:49: warning: 'graphicsPort' is deprecated: first deprecated in macOS 10.14
      [-Wdeprecated-declarations]
  context = [[NSGraphicsContext currentContext] graphicsPort];
                                                ^~~~~~~~~~~~
                                                CGContext
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphicsContext.h:111:28: note:
      property 'graphicsPort' is declared deprecated here
@property (readonly) void *graphicsPort NS_RETURNS_INNER_POINTER NS_DEPRECATED_WI...
                           ^
/System/Library/Frameworks/AppKit.framework/Headers/NSGraphicsContext.h:111:28: note:
      'graphicsPort' has been explicitly marked deprecated here
2 warnings and 1 error generated.
make: *** [macfont.o] Error 1

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
Robert Pluim <[hidden email]> writes:

>>>>>> On Tue, 14 May 2019 09:13:16 -0600, Alex Gramiak <[hidden email]> said:
>
>     Alex> Sorry, I pushed a fix for that.
>
> It gets a bit further now:
>
>   CC       xfaces.o
> xfaces.c:542:8: error: unknown type name 'GC'
> static GC
>        ^
> xfaces.c:549:10: warning: incompatible pointer to integer conversion returning
>       'Emacs_GC *' from a function with result type 'int' [-Wint-conversion]
>   return gc;
>          ^~
> 1 warning and 1 error generated.

Whoops, I missed another one. Should be fixed now.

> make: *** [xfaces.o] Error 1
>   CC       macfont.o
> macfont.m:1662:19: warning: incompatible pointer types initializing 'void (*)(struct font
>       *, const unsigned int *, int, struct font_metrics *)' with an expression of type
>       'void (struct font *, unsigned int *, int, struct font_metrics *)'
>       [-Wincompatible-pointer-types]
>   .text_extents = macfont_text_extents,
>                   ^~~~~~~~~~~~~~~~~~~~
> macfont.m:2738:1: error: conflicting types for 'macfont_text_extents'
> macfont_text_extents (struct font *font, const unsigned int *code, int nglyphs,
> ^
> macfont.m:1642:13: note: previous declaration is here
> static void macfont_text_extents (struct font *, unsigned int *, int,

Same here.

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Robert Pluim
>>>>> On Tue, 14 May 2019 09:51:50 -0600, Alex Gramiak <[hidden email]> said:

    Alex> Same here.

Now it builds and runs. Isnʼt multi-platform code FUN? :-)

Robert

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
Robert Pluim <[hidden email]> writes:

>>>>>> On Tue, 14 May 2019 09:51:50 -0600, Alex Gramiak <[hidden email]> said:
>
>     Alex> Same here.
>
> Now it builds and runs. Isnʼt multi-platform code FUN? :-)

It's absolutely blissful ;-). Thanks for testing.

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Eli Zaretskii
> From: Alex Gramiak <[hidden email]>
> Date: Tue, 14 May 2019 10:11:15 -0600
>
> > Now it builds and runs. Isnʼt multi-platform code FUN? :-)
>
> It's absolutely blissful ;-). Thanks for testing.

My turn now:

  CC       dispnew.o
In file included from dispnew.c:48:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `dispnew.o' failed
make[1]: *** [dispnew.o] Error 1
  CC       frame.o
In file included from frame.c:32:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `frame.o' failed
make[1]: *** [frame.o] Error 1
  CC       xdisp.o
In file included from xdisp.c:336:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `xdisp.o' failed
make[1]: *** [xdisp.o] Error 1
  CC       menu.o
In file included from menu.c:41:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `menu.o' failed
make[1]: *** [menu.o] Error 1
  CC       window.o
In file included from window.c:40:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `window.o' failed
make[1]: *** [window.o] Error 1
  CC       charset.o
  CC       coding.o
  CC       ccl.o
  CC       character.o
  CC       bidi.o
  CC       term.o
In file included from term.c:62:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `term.o' failed
make[1]: *** [term.o] Error 1
  CC       terminal.o
  CC       xfaces.o
In file included from xfaces.c:222:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `xfaces.o' failed
make[1]: *** [xfaces.o] Error 1
  CC       emacs.o
In file included from emacs.c:66:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `emacs.o' failed
make[1]: *** [emacs.o] Error 1
  CC       keyboard.o
In file included from keyboard.c:74:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `keyboard.o' failed
make[1]: *** [keyboard.o] Error 1
  CC       macros.o
  CC       keymap.o
  CC       sysdep.o
  CC       buffer.o
  CC       filelock.o
  CC       insdel.o
  CC       minibuf.o
  CC       fileio.o
  CC       dired.o
  CC       cmds.o
  CC       casefiddle.o
  CC       indent.o
  CC       undo.o
  CC       alloc.o
In file included from alloc.c:51:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `alloc.o' failed
make[1]: *** [alloc.o] Error 1
  CC       pdumper.o
  CC       data.o
  CC       doc.o
  CC       editfns.o
  CC       callint.o
  CC       eval.o
  CC       fns.o
  CC       font.o
In file included from font.c:44:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `font.o' failed
make[1]: *** [font.o] Error 1
  CC       print.o
  CC       lread.o
  CC       emacs-module.o
In file included from emacs-module.c:120:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `emacs-module.o' failed
make[1]: *** [emacs-module.o] Error 1
  CC       bytecode.o
  CC       process.o
In file included from process.c:128:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `process.o' failed
make[1]: *** [process.o] Error 1
  CC       gnutls.o
  CC       callproc.o
  CC       sound.o
  CC       timefns.o
  CC       atimer.o
  CC       textprop.o
  CC       composite.o
  CC       w32notify.o
In file included from w32notify.c:97:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32notify.o' failed
make[1]: *** [w32notify.o] Error 1
  CC       decompress.o
  CC       thread.o
  CC       systhread.o
In file included from systhread.c:251:0:
./w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `systhread.o' failed
make[1]: *** [systhread.o] Error 1
  CC       w32fns.o
In file included from w32fns.c:38:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
w32fns.c: In function 'w32_wnd_proc':
w32fns.c:5211:14: warning: passing argument 1 of 'SetCursor' makes pointer from
integer without a cast [-Wint-conversion]
   SetCursor (f->output_data.w32->current_cursor);
              ^
In file included from d:\usr\include\windows.h:48:0,
                 from d:\usr\include\winsock.h:52,
                 from d:\usr\include\winsock2.h:62,
                 from d:/gnu/git/emacs/trunk/nt/inc/sys/socket.h:57,
                 from thread.h:25,
                 from lisp.h:2137,
                 from w32fns.c:37:
d:\usr\include\winuser.h:4194:27: note: expected 'HCURSOR {aka struct HICON__ *}
' but argument is of type 'int'
 WINUSERAPI HCURSOR WINAPI SetCursor (HCURSOR);
                           ^~~~~~~~~
w32fns.c:5224:41: warning: assignment makes integer from pointer without a cast
[-Wint-conversion]
      f->output_data.w32->current_cursor = cursor;
                                         ^
w32fns.c: In function 'Fx_create_frame':
w32fns.c:5986:38: warning: assignment makes integer from pointer without a cast
[-Wint-conversion]
   f->output_data.w32->current_cursor = f->output_data.w32->nontext_cursor;
                                      ^
Makefile:394: recipe for target `w32fns.o' failed
make[1]: *** [w32fns.o] Error 1
  CC       w32menu.o
In file included from w32menu.c:37:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32menu.o' failed
make[1]: *** [w32menu.o] Error 1
  CC       w32reg.o
In file included from w32reg.c:25:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32reg.o' failed
make[1]: *** [w32reg.o] Error 1
  CC       w32font.o
In file included from w32font.c:27:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32font.o' failed
make[1]: *** [w32font.o] Error 1
  CC       w32term.o
In file included from w32term.c:25:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
w32term.c: In function 'w32_hide_hourglass':
w32term.c:6908:16: warning: passing argument 1 of 'SetCursor' makes pointer from
 integer without a cast [-Wint-conversion]
     SetCursor (w32->current_cursor);
                ^~~
In file included from d:\usr\include\windows.h:48:0,
                 from d:\usr\include\winsock.h:52,
                 from d:\usr\include\winsock2.h:62,
                 from d:/gnu/git/emacs/trunk/nt/inc/sys/socket.h:57,
                 from thread.h:25,
                 from lisp.h:2137,
                 from w32term.c:23:
d:\usr\include\winuser.h:4194:27: note: expected 'HCURSOR {aka struct HICON__ *}
' but argument is of type 'int'
 WINUSERAPI HCURSOR WINAPI SetCursor (HCURSOR);
                           ^~~~~~~~~
w32term.c: In function 'w32_toggle_invisible_pointer':
w32term.c:6929:5: warning: passing argument 2 of 'w32_define_cursor' makes point
er from integer without a cast [-Wint-conversion]
     f->output_data.w32->current_cursor);
     ^
w32term.c:3423:1: note: expected 'Emacs_Cursor {aka struct HICON__ *}' but argum
ent is of type 'int'
 w32_define_cursor (Window window, Emacs_Cursor cursor)
 ^~~~~~~~~~~~~~~~~
Makefile:394: recipe for target `w32term.o' failed
make[1]: *** [w32term.o] Error 1
  CC       w32xfns.o
In file included from w32xfns.c:28:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32xfns.o' failed
make[1]: *** [w32xfns.o] Error 1
  CC       w32select.o
In file included from w32select.c:78:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32select.o' failed
make[1]: *** [w32select.o] Error 1
  CC       w32uniscribe.o
In file included from w32uniscribe.c:34:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32uniscribe.o' failed
make[1]: *** [w32uniscribe.o] Error 1
  CC       w32.o
  CC       w32console.o
In file included from w32console.c:35:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32console.o' failed
make[1]: *** [w32console.o] Error 1
  CC       w32inevt.o
In file included from w32inevt.c:42:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32inevt.o' failed
make[1]: *** [w32inevt.o] Error 1
  CC       w32proc.o
In file included from w32proc.c:63:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `w32proc.o' failed
make[1]: *** [w32proc.o] Error 1
  CC       fontset.o
In file included from fontset.c:39:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `fontset.o' failed
make[1]: *** [fontset.o] Error 1
  CC       fringe.o
  CC       image.o
In file included from image.c:60:0:
w32term.h:371:3: error: unknown type name 'Cursor'
   Cursor current_cursor;
   ^~~~~~
Makefile:394: recipe for target `image.o' failed
make[1]: *** [image.o] Error 1

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Stefan Monnier
>> From: Alex Gramiak <[hidden email]>
>> Date: Tue, 14 May 2019 10:11:15 -0600
>> > Now it builds and runs. Isnʼt multi-platform code FUN? :-)
>> It's absolutely blissful ;-). Thanks for testing.
> My turn now:

Guys, this is unfair.
Why do only the users of proprietary systems get to have fun?


        Stefan


Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
In reply to this post by Eli Zaretskii
Eli Zaretskii <[hidden email]> writes:

> My turn now:
>
>   CC       dispnew.o
> In file included from dispnew.c:48:0:
> w32term.h:371:3: error: unknown type name 'Cursor'
>    Cursor current_cursor;
>    ^~~~~~
> [...]

Whoops, I forgot about that lonesome cursor. I pushed a fix for that.

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
In reply to this post by Stefan Monnier
Stefan Monnier <[hidden email]> writes:

>>> From: Alex Gramiak <[hidden email]>
>>> Date: Tue, 14 May 2019 10:11:15 -0600
>>> > Now it builds and runs. Isnʼt multi-platform code FUN? :-)
>>> It's absolutely blissful ;-). Thanks for testing.
>> My turn now:
>
> Guys, this is unfair.
> Why do only the users of proprietary systems get to have fun?

I'll make sure to leave some errors on Free systems for you in future
patches. :-)

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Eli Zaretskii
In reply to this post by Alex Gramiak
> From: Alex Gramiak <[hidden email]>
> Cc: [hidden email]
> Date: Tue, 14 May 2019 13:48:09 -0600
>
> >   CC       dispnew.o
> > In file included from dispnew.c:48:0:
> > w32term.h:371:3: error: unknown type name 'Cursor'
> >    Cursor current_cursor;
> >    ^~~~~~
> > [...]
>
> Whoops, I forgot about that lonesome cursor. I pushed a fix for that.

Thanks, it builds now.

Regarding the patch, I have only one comment:

> @@ -1289,7 +1317,7 @@ struct glyph_string
>    enum glyph_row_area area;
>
>    /* Characters to be drawn, and number of characters.  */
> -  XChar2b *char2b;
> +  unsigned short *char2b;
>    int nchars;

Why use 'unsigned short' and not 'unsigned int'?  The latter is more
efficient on modern architectures, and in structures you will likely
have the compiler pad the following 16 bits anyway.

Reply | Threaded
Open this post in threaded view
|

Re: scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef

Alex Gramiak
Eli Zaretskii <[hidden email]> writes:

> Thanks, it builds now.
>
> Regarding the patch, I have only one comment:
>
>> @@ -1289,7 +1317,7 @@ struct glyph_string
>>    enum glyph_row_area area;
>>
>>    /* Characters to be drawn, and number of characters.  */
>> -  XChar2b *char2b;
>> +  unsigned short *char2b;
>>    int nchars;
>
> Why use 'unsigned short' and not 'unsigned int'?  The latter is more
> efficient on modern architectures, and in structures you will likely
> have the compiler pad the following 16 bits anyway.

I thought that it would be better to only use a (minimum) 16-bit
unsigned if that's all that is needed. If it's more efficient to use
unsigned then that's even better, since some loops and alloca calls in,
e.g., {x,w32}_compute_glyph_string_overhangs can be removed.

I'll change the type to unsigned and merge the branch later if there are
no objections.