-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open Watcom 16-bit BSD API build warnings #112
Comments
That would be the expansion of the When Edit: |
I'm not sure what's going on in those switches but nature of the warning is that a 16-bit CPU can only shift up to 15 bits. /* Compile with wcc bit.c or wcc386 bit.c */
#include <stdio.h>
int main(void) {
volatile int test;
test = test << 15; /* Maximum bit-shift for a 8086 */
test = test << 16; /* Too large of a bit-shift for a 8086 */
test = test << 32; /* Too large of a bit-shift for a 80386 */
test = test << 64; /* Too large of a bit-shift for a x86_64 */
return 0;
} I have no idea if Watcoms warning means the compiler doesn't know what to do or if it's merely telling us it's poor form. As I said earlier I've had no issue when running projects that link to the large model library |
The warnings are correct since the definition of e.g.
( But very few of these
the macro int W32_CALL ioctlsocket (int s, long cmd, void *argp)
{
Socket *socket = _socklist_find (s);
SOCK_PROLOGUE (socket, "\nioctlsocket:%d", s);
SOCK_DEBUGF ((", %s", get_ioctl_cmd(cmd)));
switch (IOCGROUP(cmd))
... Could do all this |
Maybe a As a rough example: typedef union _iocGroup {
long l;
short s[2];
char c[4];
} IocGroup; int W32_CALL ioctlsocket (int s, long cmd, void *argp)
IocGroup group;
group.l = cmd; swtich(IOCGROUP(cmd.s[0]) {
...
}
switch(IOCGROUP(cmd.s[1]) {
...
case (0x40000000 | ( (sizeof (short) &0x7f) <<1) | ('f'<<8) |127) :
...
} I think that'd work but maybe there's a better way that would still allow a compiler to optimize a single switch for 32-bit builds Edit: code correction from #112 (comment) |
Good idea. I assume you mean: typedef union _iocGroup {
long l;
short s [2];
char c [4];
} IocGroup; |
Take into account following bit-size for type in dependency on compiler target architecture
If you want 32-bit type for both architectures then long type is OK |
Tested this: the following code compiles on #include <stdio.h>
int main(void) {
volatile long test;
test = test << 31;
return 0;
} Fantastic work! |
When
USE_BSD_API
is defined for a 16-bit DOS with Open Watcom build (wmake -h -f watcom_l.mak
). The following warnings appear:These warning haven't caused any trouble in my projects. Creating this issue just to document it in case it's the cause of a bug found in the future
The text was updated successfully, but these errors were encountered: