public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Fix compilation using mingw.org's MinGW
@ 2019-04-18 15:36 Eli Zaretskii
  2019-04-18 17:01 ` Kevin Buettner
  2019-04-18 17:20 ` Pedro Alves
  0 siblings, 2 replies; 28+ messages in thread
From: Eli Zaretskii @ 2019-04-18 15:36 UTC (permalink / raw)
  To: gdb-patches

windows-nat.c uses CONSOLE_FONT_INFO unconditionally, but the
corresponding declaration in the Windows API headers is conditional,
because the APIs using CONSOLE_FONT_INFO are only available since
Windows XP.  When that condition doesn't hold, windows-nat.c won't
compile:

     windows-nat.c:114:10: error: 'CONSOLE_FONT_INFO' has not been declared
	       CONSOLE_FONT_INFO *);
	       ^~~~~~~~~~~~~~~~~
     windows-nat.c: In function 'void windows_set_console_info(STARTUPINFOA*, DWORD*)':
     windows-nat.c:2174:7: error: 'CONSOLE_FONT_INFO' was not declared in this scope
	    CONSOLE_FONT_INFO cfi;
	    ^~~~~~~~~~~~~~~~~
     windows-nat.c:2174:7: note: suggested alternative: 'CONSOLE_CURSOR_INFO'
	    CONSOLE_FONT_INFO cfi;
	    ^~~~~~~~~~~~~~~~~
	    CONSOLE_CURSOR_INFO
     windows-nat.c:2176:48: error: 'cfi' was not declared in this scope
	    GetCurrentConsoleFont (hconsole, FALSE, &cfi);
						     ^~~
     windows-nat.c: At global scope:
     windows-nat.c:3302:55: error: 'CONSOLE_FONT_INFO' has not been declared
      bad_GetCurrentConsoleFont (HANDLE w, BOOL bMaxWindow, CONSOLE_FONT_INFO *f)
							    ^~~~~~~~~~~~~~~~~
     windows-nat.c: In function 'BOOL bad_GetCurrentConsoleFont(HANDLE, BOOL, int*)':

     windows-nat.c:3304:6: error: request for member 'nFont' in '* f', which is of non-class type 'int'
	f->nFont = 0;
	   ^~~~~

MinGW64 no longer supports versions of Windows older than XP, but
mingw.org's MinGW does.  Since we load GetCurrentConsoleFont
dynamically at run time, and have code for when the load fails, it
makes sense to not assume XP at compile time.  The patch below does
that.  OK to push (with the pertinent ChangeLog entry)?

--- gdb/windows-nat.c~0	2019-03-27 00:52:05.000000000 +0200
+++ gdb/windows-nat.c	2019-04-18 11:37:02.061945600 +0300
@@ -81,6 +81,16 @@
 #define GetConsoleFontSize		dyn_GetConsoleFontSize
 #define GetCurrentConsoleFont		dyn_GetCurrentConsoleFont
 
+#if _WIN32_WINNT < 0x0501
+
+typedef
+struct _CONSOLE_FONT_INFO
+{ DWORD 			nFont;
+  COORD 			dwFontSize;
+} CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO;
+
+#endif
+
 typedef BOOL WINAPI (AdjustTokenPrivileges_ftype) (HANDLE, BOOL,
 						   PTOKEN_PRIVILEGES,
 						   DWORD, PTOKEN_PRIVILEGES,

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

end of thread, other threads:[~2019-05-03  8:26 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 15:36 Fix compilation using mingw.org's MinGW Eli Zaretskii
2019-04-18 17:01 ` Kevin Buettner
2019-04-18 18:54   ` Eli Zaretskii
2019-04-18 20:38     ` Kevin Buettner
2019-04-19  6:19       ` Eli Zaretskii
2019-04-18 17:20 ` Pedro Alves
2019-04-18 17:22   ` Pedro Alves
2019-04-18 18:57     ` Eli Zaretskii
2019-04-19 10:51       ` Pedro Alves
2019-04-19 11:23         ` Eli Zaretskii
2019-04-19 11:33           ` Pedro Alves
2019-04-28 14:33             ` Eli Zaretskii
2019-04-30 12:56               ` Pedro Alves
2019-04-30 13:06                 ` LRN
2019-04-30 15:25                   ` Eli Zaretskii
2019-04-30 17:04                     ` Pedro Alves
2019-04-30 17:17                       ` Eli Zaretskii
2019-04-30 17:26                         ` Pedro Alves
2019-04-30 17:40                           ` Eli Zaretskii
2019-04-30 17:58                             ` Pedro Alves
2019-04-30 18:34                               ` Eli Zaretskii
2019-04-30 18:38                                 ` Pedro Alves
2019-04-30 17:50                     ` LRN
2019-04-30 13:10                 ` Pedro Alves
2019-04-30 15:23                   ` Eli Zaretskii
2019-04-30 16:31                     ` Pedro Alves
2019-05-03  8:04                       ` Eli Zaretskii
2019-05-03  8:26                 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).