diff options
| author | Eli Zaretskii | 2014-09-25 12:34:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-25 12:34:53 +0300 |
| commit | db61bdb13915a15896ffb96d1ea3d23e00f4bf54 (patch) | |
| tree | 9fb3faba58b2ec6b9da881003bc742ea97df634f | |
| parent | 340e4cce7aaa1de72d384e4889f0f8aa65025874 (diff) | |
| download | emacs-db61bdb13915a15896ffb96d1ea3d23e00f4bf54.tar.gz emacs-db61bdb13915a15896ffb96d1ea3d23e00f4bf54.zip | |
Default to stack objects on DOS_NT platforms as well.
src/w32term.h (ALIGN_STACK) [__GNUC__]: Define to
__attribute__((force_align_arg_pointer)) for GCC 4.2 and later.
src/lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition.
src/w32proc.c (enum_locale_fn, enum_codepage_fn): Add the
ALIGN_STACK attribute.
src/w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute.
src/w32uniscribe.c (add_opentype_font_name_to_list): Add the
ALIGN_STACK attribute.
src/w32font.c (add_font_name_to_list, add_font_entity_to_list)
(add_one_font_entity_to_list): Add the ALIGN_STACK attribute.
| -rw-r--r-- | src/ChangeLog | 19 | ||||
| -rw-r--r-- | src/lisp.h | 8 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32font.c | 24 | ||||
| -rw-r--r-- | src/w32proc.c | 4 | ||||
| -rw-r--r-- | src/w32term.h | 16 | ||||
| -rw-r--r-- | src/w32uniscribe.c | 8 |
7 files changed, 57 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e6805691ecb..9c360e64de0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2014-09-25 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | Default to stack objects on DOS_NT platforms as well. | ||
| 4 | * w32term.h (ALIGN_STACK) [__GNUC__]: Define to | ||
| 5 | __attribute__((force_align_arg_pointer)) for GCC 4.2 and later. | ||
| 6 | |||
| 7 | * lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition. | ||
| 8 | |||
| 9 | * w32proc.c (enum_locale_fn, enum_codepage_fn): Add the | ||
| 10 | ALIGN_STACK attribute. | ||
| 11 | |||
| 12 | * w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute. | ||
| 13 | |||
| 14 | * w32uniscribe.c (add_opentype_font_name_to_list): Add the | ||
| 15 | ALIGN_STACK attribute. | ||
| 16 | |||
| 17 | * w32font.c (add_font_name_to_list, add_font_entity_to_list) | ||
| 18 | (add_one_font_entity_to_list): Add the ALIGN_STACK attribute. | ||
| 19 | |||
| 1 | 2014-09-25 Martin Rudalics <rudalics@gmx.at> | 20 | 2014-09-25 Martin Rudalics <rudalics@gmx.at> |
| 2 | 21 | ||
| 3 | * frame.c (frame_inhibit_resize): | 22 | * frame.c (frame_inhibit_resize): |
diff --git a/src/lisp.h b/src/lisp.h index 4cd2e69dac3..f76008e8f5e 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -282,12 +282,10 @@ error !; | |||
| 282 | # endif | 282 | # endif |
| 283 | #endif | 283 | #endif |
| 284 | 284 | ||
| 285 | /* This should work with GCC on non-DOS_NT. Clang has known problems; see | 285 | /* This should work with GCC. Clang has known problems; see |
| 286 | http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00506.html. | 286 | http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00506.html. */ |
| 287 | Also http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00422.html | ||
| 288 | describes an issue with 32-bit MS-Windows. */ | ||
| 289 | #ifndef USE_STACK_LISP_OBJECTS | 287 | #ifndef USE_STACK_LISP_OBJECTS |
| 290 | # if defined __GNUC__ && !defined __clang__ && !defined DOS_NT | 288 | # if defined __GNUC__ && !defined __clang__ |
| 291 | # define USE_STACK_LISP_OBJECTS true | 289 | # define USE_STACK_LISP_OBJECTS true |
| 292 | # else | 290 | # else |
| 293 | # define USE_STACK_LISP_OBJECTS false | 291 | # define USE_STACK_LISP_OBJECTS false |
diff --git a/src/w32fns.c b/src/w32fns.c index 2b77bb737b6..0a8bde1f661 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -5012,7 +5012,7 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 5012 | return Qnil; | 5012 | return Qnil; |
| 5013 | } | 5013 | } |
| 5014 | 5014 | ||
| 5015 | static BOOL CALLBACK | 5015 | static BOOL CALLBACK ALIGN_STACK |
| 5016 | w32_monitor_enum (HMONITOR monitor, HDC hdc, RECT *rcMonitor, LPARAM dwData) | 5016 | w32_monitor_enum (HMONITOR monitor, HDC hdc, RECT *rcMonitor, LPARAM dwData) |
| 5017 | { | 5017 | { |
| 5018 | Lisp_Object *monitor_list = (Lisp_Object *) dwData; | 5018 | Lisp_Object *monitor_list = (Lisp_Object *) dwData; |
diff --git a/src/w32font.c b/src/w32font.c index 7b2aac1cbf2..895931843ba 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -115,15 +115,15 @@ static void compute_metrics (HDC, struct w32font_info *, unsigned int, | |||
| 115 | static Lisp_Object w32_registry (LONG, DWORD); | 115 | static Lisp_Object w32_registry (LONG, DWORD); |
| 116 | 116 | ||
| 117 | /* EnumFontFamiliesEx callbacks. */ | 117 | /* EnumFontFamiliesEx callbacks. */ |
| 118 | static int CALLBACK add_font_entity_to_list (ENUMLOGFONTEX *, | 118 | static int CALLBACK ALIGN_STACK add_font_entity_to_list (ENUMLOGFONTEX *, |
| 119 | NEWTEXTMETRICEX *, | 119 | NEWTEXTMETRICEX *, |
| 120 | DWORD, LPARAM); | 120 | DWORD, LPARAM); |
| 121 | static int CALLBACK add_one_font_entity_to_list (ENUMLOGFONTEX *, | 121 | static int CALLBACK ALIGN_STACK add_one_font_entity_to_list (ENUMLOGFONTEX *, |
| 122 | NEWTEXTMETRICEX *, | 122 | NEWTEXTMETRICEX *, |
| 123 | DWORD, LPARAM); | 123 | DWORD, LPARAM); |
| 124 | static int CALLBACK add_font_name_to_list (ENUMLOGFONTEX *, | 124 | static int CALLBACK ALIGN_STACK add_font_name_to_list (ENUMLOGFONTEX *, |
| 125 | NEWTEXTMETRICEX *, | 125 | NEWTEXTMETRICEX *, |
| 126 | DWORD, LPARAM); | 126 | DWORD, LPARAM); |
| 127 | 127 | ||
| 128 | /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track | 128 | /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track |
| 129 | of what we really want. */ | 129 | of what we really want. */ |
| @@ -1000,7 +1000,7 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity, | |||
| 1000 | 1000 | ||
| 1001 | /* Callback function for EnumFontFamiliesEx. | 1001 | /* Callback function for EnumFontFamiliesEx. |
| 1002 | * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ | 1002 | * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ |
| 1003 | static int CALLBACK | 1003 | static int CALLBACK ALIGN_STACK |
| 1004 | add_font_name_to_list (ENUMLOGFONTEX *logical_font, | 1004 | add_font_name_to_list (ENUMLOGFONTEX *logical_font, |
| 1005 | NEWTEXTMETRICEX *physical_font, | 1005 | NEWTEXTMETRICEX *physical_font, |
| 1006 | DWORD font_type, LPARAM list_object) | 1006 | DWORD font_type, LPARAM list_object) |
| @@ -1446,7 +1446,7 @@ check_face_name (LOGFONT *font, char *full_name) | |||
| 1446 | * and if so, adds it to a list. Both the data we are checking against | 1446 | * and if so, adds it to a list. Both the data we are checking against |
| 1447 | * and the list to which the fonts are added are passed in via the | 1447 | * and the list to which the fonts are added are passed in via the |
| 1448 | * lparam argument, in the form of a font_callback_data struct. */ | 1448 | * lparam argument, in the form of a font_callback_data struct. */ |
| 1449 | static int CALLBACK | 1449 | static int CALLBACK ALIGN_STACK |
| 1450 | add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | 1450 | add_font_entity_to_list (ENUMLOGFONTEX *logical_font, |
| 1451 | NEWTEXTMETRICEX *physical_font, | 1451 | NEWTEXTMETRICEX *physical_font, |
| 1452 | DWORD font_type, LPARAM lParam) | 1452 | DWORD font_type, LPARAM lParam) |
| @@ -1565,7 +1565,7 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1565 | 1565 | ||
| 1566 | /* Callback function for EnumFontFamiliesEx. | 1566 | /* Callback function for EnumFontFamiliesEx. |
| 1567 | * Terminates the search once we have a match. */ | 1567 | * Terminates the search once we have a match. */ |
| 1568 | static int CALLBACK | 1568 | static int CALLBACK ALIGN_STACK |
| 1569 | add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font, | 1569 | add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font, |
| 1570 | NEWTEXTMETRICEX *physical_font, | 1570 | NEWTEXTMETRICEX *physical_font, |
| 1571 | DWORD font_type, LPARAM lParam) | 1571 | DWORD font_type, LPARAM lParam) |
diff --git a/src/w32proc.c b/src/w32proc.c index dc91910d9a7..b255c57cd7c 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -2909,7 +2909,7 @@ int_from_hex (char * s) | |||
| 2909 | function isn't given a context pointer. */ | 2909 | function isn't given a context pointer. */ |
| 2910 | Lisp_Object Vw32_valid_locale_ids; | 2910 | Lisp_Object Vw32_valid_locale_ids; |
| 2911 | 2911 | ||
| 2912 | static BOOL CALLBACK | 2912 | static BOOL CALLBACK ALIGN_STACK |
| 2913 | enum_locale_fn (LPTSTR localeNum) | 2913 | enum_locale_fn (LPTSTR localeNum) |
| 2914 | { | 2914 | { |
| 2915 | DWORD id = int_from_hex (localeNum); | 2915 | DWORD id = int_from_hex (localeNum); |
| @@ -2973,7 +2973,7 @@ If successful, the new locale id is returned, otherwise nil. */) | |||
| 2973 | function isn't given a context pointer. */ | 2973 | function isn't given a context pointer. */ |
| 2974 | Lisp_Object Vw32_valid_codepages; | 2974 | Lisp_Object Vw32_valid_codepages; |
| 2975 | 2975 | ||
| 2976 | static BOOL CALLBACK | 2976 | static BOOL CALLBACK ALIGN_STACK |
| 2977 | enum_codepage_fn (LPTSTR codepageNum) | 2977 | enum_codepage_fn (LPTSTR codepageNum) |
| 2978 | { | 2978 | { |
| 2979 | DWORD id = atoi (codepageNum); | 2979 | DWORD id = atoi (codepageNum); |
diff --git a/src/w32term.h b/src/w32term.h index 0fabe12819c..fcadca6a9af 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -22,6 +22,22 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include "frame.h" | 22 | #include "frame.h" |
| 23 | #include "atimer.h" | 23 | #include "atimer.h" |
| 24 | 24 | ||
| 25 | /* Stack alignment stuff. Every CALLBACK function should have the | ||
| 26 | ALIGN_STACK attribute if it manipulates Lisp objects, because | ||
| 27 | Windows x86 32-bit ABI only guarantees 4-byte stack alignment, and | ||
| 28 | that is what we will get when a Windows function calls us. The | ||
| 29 | ALIGN_STACK attribute forces GCC to emit a preamble code to | ||
| 30 | re-align the stack at function entry. Further details about this | ||
| 31 | can be found in http://www.peterstock.co.uk/games/mingw_sse/. */ | ||
| 32 | #ifdef __GNUC__ | ||
| 33 | # if defined USE_STACK_LISP_OBJECTS && defined _W64 \ | ||
| 34 | && __GNUC__ + (__GNUC_MINOR__ > 1) >= 5 | ||
| 35 | # define ALIGN_STACK __attribute__((force_align_arg_pointer)) | ||
| 36 | # else | ||
| 37 | # define ALIGN_STACK | ||
| 38 | # endif /* USE_STACK_LISP_OBJECTS */ | ||
| 39 | #endif | ||
| 40 | |||
| 25 | 41 | ||
| 26 | #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0) | 42 | #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0) |
| 27 | #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255) | 43 | #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255) |
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 7e6419c4d28..1c7b256988c 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c | |||
| @@ -52,9 +52,9 @@ extern Lisp_Object Quniscribe; | |||
| 52 | extern Lisp_Object Qopentype; | 52 | extern Lisp_Object Qopentype; |
| 53 | 53 | ||
| 54 | /* EnumFontFamiliesEx callback. */ | 54 | /* EnumFontFamiliesEx callback. */ |
| 55 | static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, | 55 | static int CALLBACK ALIGN_STACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, |
| 56 | NEWTEXTMETRICEX *, | 56 | NEWTEXTMETRICEX *, |
| 57 | DWORD, LPARAM); | 57 | DWORD, LPARAM); |
| 58 | /* Used by uniscribe_otf_capability. */ | 58 | /* Used by uniscribe_otf_capability. */ |
| 59 | static Lisp_Object otf_features (HDC context, char *table); | 59 | static Lisp_Object otf_features (HDC context, char *table); |
| 60 | 60 | ||
| @@ -613,7 +613,7 @@ uniscribe_encode_char (struct font *font, int c) | |||
| 613 | /* Callback function for EnumFontFamiliesEx. | 613 | /* Callback function for EnumFontFamiliesEx. |
| 614 | Adds the name of opentype fonts to a Lisp list (passed in as the | 614 | Adds the name of opentype fonts to a Lisp list (passed in as the |
| 615 | lParam arg). */ | 615 | lParam arg). */ |
| 616 | static int CALLBACK | 616 | static int CALLBACK ALIGN_STACK |
| 617 | add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, | 617 | add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, |
| 618 | NEWTEXTMETRICEX *physical_font, | 618 | NEWTEXTMETRICEX *physical_font, |
| 619 | DWORD font_type, LPARAM list_object) | 619 | DWORD font_type, LPARAM list_object) |