Hi again!

On Wed, Apr 15, 2020 at 1:27 PM Jehan Pagès <[email protected]>
wrote:

> Hi!
>
> I had a case today when a dependency in GIMP CI would fail because they
> recently added -Wstrict-prototypes to their list of warnings (additionally
> to existing -Werror).
>
> The attached patch fixes some headers to make them strict-prototypes
> compliant… well at least the ones which were included by this specific
> project.
>
> I have not made a full review of the whole header files so I guess some
> more work may be needed for the long run (a ` grep -rI '( *);'
> mingw-w64-headers/include/` gives me a lot of result, though not all of
> them are function prototypes so it needs a bit more than automatic
> search-and-replace (or a better regexp at least).
>

After sending the previous patch, I thought I was a bit lazy and that was
not cool to you. So I made an additional patch (attached).
Basically I did a sed like this:

$ sed -i 's/\(^[a-zA-Z0-9]\+ \+[a-zA-Z0-9]\+ *\)( *);/\1(void);/g'
mingw-w64-headers/include/*.h

The difficulty was to not grep class functions or struct pointers to
functions so I tried to only grep without space at the line start. But then
I had to do some additional manual tweaking to catch some more prototypes
which were actually indented. Hopefully I did not make any mistake. :-)

Jehan

Thanks!
>
> Jehan
>

-- 
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot
From bc515a68fe79bff5105645e3d6f417609a16187a Mon Sep 17 00:00:00 2001
From: Jehan <[email protected]>
Date: Wed, 15 Apr 2020 13:49:47 +0200
Subject: [PATCH 2/2] headers: some additional strict prototyping.

Found by some basic search-and-replace pattern and some additional
manual fixing. The difficulty is to not catch class functions as C++
does not require this.
---
 mingw-w64-headers/include/mshtmhst.h | 2 +-
 mingw-w64-headers/include/ratings.h  | 6 +++---
 mingw-w64-headers/include/shlwapi.h  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-headers/include/mshtmhst.h b/mingw-w64-headers/include/mshtmhst.h
index c4f4a3f3..85569e50 100644
--- a/mingw-w64-headers/include/mshtmhst.h
+++ b/mingw-w64-headers/include/mshtmhst.h
@@ -164,7 +164,7 @@ STDAPI ShowModelessHTMLDialog (HWND hwndParent, IMoniker *pMk, VARIANT *pvarArgI
 STDAPI RunHTMLApplication (HINSTANCE hinst, HINSTANCE hPrevInst, LPSTR szCmdLine, int nCmdShow);
 #endif
 STDAPI CreateHTMLPropertyPage (IMoniker *pmk, IPropertyPage **ppPP);
-STDAPI EarlyStartDisplaySystem ();
+STDAPI EarlyStartDisplaySystem (void);
 STDAPI IERegisterXMLNS (LPCWSTR lpszURI, GUID clsid, BOOL fMachine);
 STDAPI IEIsXMLNSRegistered (LPCWSTR lpszURI, GUID *pCLSID);
 STDAPI GetColorValueFromString (LPCWSTR lpszColor, BOOL fStrictCSS1, BOOL fIsStandardsCSS, COLORREF *pColor);
diff --git a/mingw-w64-headers/include/ratings.h b/mingw-w64-headers/include/ratings.h
index e7fee928..ea40ecf1 100644
--- a/mingw-w64-headers/include/ratings.h
+++ b/mingw-w64-headers/include/ratings.h
@@ -33,9 +33,9 @@ STDAPI RatingAddToApprovedSites (HWND hDlg, DWORD cbPasswordBlob, BYTE *pbPasswo
 STDAPI RatingClickedOnPRFInternal (HWND hWndOwner, HINSTANCE, LPSTR lpszFileName, int nShow);
 STDAPI RatingClickedOnRATInternal (HWND hWndOwner, HINSTANCE, LPSTR lpszFileName, int nShow);
 
-STDAPI RatingEnabledQuery();
-STDAPI RatingInit();
-STDAPI_(void) RatingTerm();
+STDAPI RatingEnabledQuery(void);
+STDAPI RatingInit(void);
+STDAPI_(void) RatingTerm(void);
 
 static inline WINBOOL IS_RATINGS_ENABLED() {
   TCHAR sz[200];
diff --git a/mingw-w64-headers/include/shlwapi.h b/mingw-w64-headers/include/shlwapi.h
index 4eb08d69..6e3ea992 100644
--- a/mingw-w64-headers/include/shlwapi.h
+++ b/mingw-w64-headers/include/shlwapi.h
@@ -935,7 +935,7 @@ typedef const QITAB *LPCQITAB;
 #define CTF_WAIT_ALLOWCOM 0x00000040
 
   LWSTDAPI_(WINBOOL) SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc,void *pData,DWORD dwFlags,LPTHREAD_START_ROUTINE pfnCallback);
-  LWSTDAPI SHReleaseThreadRef();
+  LWSTDAPI SHReleaseThreadRef(void);
 
 #ifndef NO_SHLWAPI_GDI
   LWSTDAPI_(HPALETTE) SHCreateShellPalette(HDC hdc);
@@ -974,7 +974,7 @@ typedef const QITAB *LPCQITAB;
   STDAPI DllInstall(WINBOOL bInstall,LPCWSTR pszCmdLine);
 
 #if (_WIN32_IE >= 0x0602)
-  LWSTDAPI_(WINBOOL) IsInternetESCEnabled();
+  LWSTDAPI_(WINBOOL) IsInternetESCEnabled(void);
 #endif
 
 LWSTDAPI_(IStream *) SHCreateMemStream(const BYTE *pInit, _In_ UINT cbInit);
-- 
2.25.2

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to