NetBSD compiler warnings patches - review request
Austin English
austinenglish at gmail.com
Thu Apr 23 11:46:38 CDT 2009
Howdy,
I recently started retesting NetBSD (5.0 this time), and have filed
bugs for most of the warnings. A few of them I have patches ready for,
but figured I should probably get reviewed first:
First up, bug 18161:
gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_NTSYSTEM_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith
-I/usr/pkg/include -I/usr/include -I/usr/X11R7/include/freetype2
-I/usr/X11R7/include -O2 -I/usr/pkg/include -I/usr/include
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -o cdrom.o cdrom.c
cdrom.c: In function 'CDROM_DeviceIoControl':
cdrom.c:1728: warning: 'lun' may be used uninitialized in this function
cdrom.c:1728: warning: 'targetid' may be used uninitialized in this function
cdrom.c:1728: warning: 'busid' may be used uninitialized in this function
cdrom.c:1728: warning: 'portnum' may be used uninitialized in this function
Fixed by cdrom.txt
Bug 18162:
gcc -c -I. -I. -I../../../include -I../../../include -D_REENTRANT -fPIC -Wall
-pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings
-Wpointer-arith -I/usr/pkg/include -I/usr/include
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -O2 -I/usr/pkg/include
-I/usr/include -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -o
treeview.o treeview.c
treeview.c: In function 'TestCallback':
treeview.c:279: warning: value computed is not used
treeview.c:304: warning: value computed is not used
treeview.c:313: warning: value computed is not used
treeview.c:322: warning: value computed is not used
treeview.c: In function 'TestExpandInvisible':
treeview.c:769: warning: value computed is not used
Fixed by treeview.txt. Also tested on windows 2k, test still passes.
Bug 18165:
gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_REENTRANT
-fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement
-Wwrite-strings -Wpointer-arith -I/usr/pkg/include -I/usr/include
-I/usr/X11R7/include/f
reetype2 -I/usr/X11R7/include -O2 -I/usr/pkg/include -I/usr/include
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -o net.o net.c
net.c: In function 'netconn_init':
net.c:243: warning: assignment discards qualifiers from pointer target type
Fixed by winhttp.txt. Also fixes a similar problem in wininet/netconnection.c
Bug 18166:
gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_NTSYSTEM_
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith
-I/usr/pkg/include -I/usr/include -I/usr/X11R7/include/freetype2
-I/usr/X11R7/include -O2 -I/usr/pkg/include -I/usr/include
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -o directory.o directory.c
directory.c: In function 'wine_getdirentries':
directory.c:1289: warning: implicit declaration of function 'getdirentries'
There's a NetBSD bug here. Their version of getdirentries returns the
old 32-bit inode struct dirent, while dirent.h has the new 64-bit
inode struct dirent inode since NetBSD version 3.99.8. While it
arguably should be fixed on their end, we already have a wrapper in
there for an OS X bug...
directory.txt fixes it.
--
-Austin
-------------- next part --------------
diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index 574f737..465140e 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -1725,7 +1725,10 @@ static NTSTATUS CDROM_ScsiGetCaps(PIO_SCSI_CAPABILITIES caps)
*/
static NTSTATUS CDROM_GetAddress(int fd, SCSI_ADDRESS* address)
{
- UCHAR portnum, busid, targetid, lun;
+ UCHAR portnum = 0;
+ UCHAR busid = 0;
+ UCHAR targetid = 0;
+ UCHAR lun = 0;
address->Length = sizeof(SCSI_ADDRESS);
if ( ! CDROM_GetInterfaceInfo(fd, &portnum, &busid, &targetid, &lun))
@@ -1734,7 +1737,7 @@ static NTSTATUS CDROM_GetAddress(int fd, SCSI_ADDRESS* address)
address->PortNumber = portnum; /* primary=0 secondary=1 for ide */
address->PathId = busid; /* always 0 for ide */
address->TargetId = targetid; /* master=0 slave=1 for ide */
- address->Lun = lun;
+ address->Lun = lun; /* default is 0 for SCSI */
return STATUS_SUCCESS;
}
-------------- next part --------------
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 05a5237..dde3b29 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -276,7 +276,7 @@ static void TestCallback(void)
CHAR buf[128];
LRESULT ret;
- TreeView_DeleteAllItems(hTree);
+ (void) TreeView_DeleteAllItems(hTree);
ins.hParent = TVI_ROOT;
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = TVIF_TEXT;
@@ -301,7 +301,7 @@ static void TestCallback(void)
assert(hItem1);
tvi.hItem = hItem1;
- TreeView_GetItem(hTree, &tvi);
+ (void) TreeView_GetItem(hTree, &tvi);
ok(strcmp(tvi.pszText, test_string) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, test_string);
@@ -310,7 +310,7 @@ static void TestCallback(void)
ret = TreeView_SetItem(hTree, &tvi);
ok(ret == 1, "Expected SetItem return 1, got %ld\n", ret);
tvi.pszText = buf;
- TreeView_GetItem(hTree, &tvi);
+ (void) TreeView_GetItem(hTree, &tvi);
ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, TEST_CALLBACK_TEXT);
@@ -319,7 +319,7 @@ static void TestCallback(void)
assert(hItem2);
tvi.hItem = hItem2;
memset(buf, 0, sizeof(buf));
- TreeView_GetItem(hTree, &tvi);
+ (void) TreeView_GetItem(hTree, &tvi);
ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, TEST_CALLBACK_TEXT);
}
@@ -766,7 +766,7 @@ static void TestExpandInvisible(void)
*
*/
- TreeView_DeleteAllItems(hTree);
+ (void) TreeView_DeleteAllItems(hTree);
ins.hParent = TVI_ROOT;
ins.hInsertAfter = TVI_ROOT;
-------------- next part --------------
diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 79e6789..3c68ee0 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -82,7 +82,7 @@ static CRITICAL_SECTION cs_gethostbyname = { &critsect_debug, -1, 0, 0, 0, 0 };
static void *libssl_handle;
static void *libcrypto_handle;
-static SSL_METHOD *method;
+static const SSL_METHOD *method;
static SSL_CTX *ctx;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c
index 3c55528..cf9a8d2 100644
--- a/dlls/wininet/netconnection.c
+++ b/dlls/wininet/netconnection.c
@@ -101,7 +101,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
static void *OpenSSL_ssl_handle;
static void *OpenSSL_crypto_handle;
-static SSL_METHOD *meth;
+static const SSL_METHOD *meth;
static SSL_CTX *ctx;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
-------------- next part --------------
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 41880f4..6e38743 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -129,6 +129,16 @@ static inline int getdents64( int fd, char *de, unsigned int size )
#endif /* linux */
+#if defined (__NetBSD__) /* getdirentries is broken on NetBSD */
+
+int getdirentries_netbsd(int fd, char *buf, int nbytes, long *basep)
+{
+ *basep = (long)lseek(fd, 0, SEEK_CUR);
+ return getdents(fd, buf, (size_t)nbytes);
+}
+#define getdirentries getdirentries_netbsd
+#endif
+
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
More information about the wine-devel
mailing list