Skip to content

Commit

Permalink
Revert "fix resource compiler incorrect handling >= and <= operator (…
Browse files Browse the repository at this point in the history
…issue #1176)"

This reverts commit 3b87c5e.
  • Loading branch information
jmalak committed Dec 29, 2023
1 parent 3b87c5e commit 3afc882
Show file tree
Hide file tree
Showing 36 changed files with 2,631 additions and 1,032 deletions.
7 changes: 0 additions & 7 deletions bld/cc/gml/cerrs.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2555,13 +2555,6 @@ A unary operator without being followed by an operand.
:MSGJTXT. %s
.np
This is a internal error message generated by compiler.
:MSGSYM. ERR_RESERVED_REG
:ERROR. 1
:MSGTXT. Register '%s' is reserved and cannot be used by #pragma aux
:MSGJTXT. Register '%s' is reserved and cannot be used by #pragma aux
.np
The register is reserved by code generator and therefore cannot be used in
#pragma aux.
:eMSGGRP. Errs
:cmt -------------------------------------------------------------------
:MSGGRP. Info
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/environ/c/setenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#endif
#include "rtdata.h"
#include "rterrno.h"
#include "seterrno.h"
#ifdef __NT__
#include "libwin32.h"
#endif
Expand Down Expand Up @@ -109,7 +108,8 @@ _WCRTLINK int __F_NAME(setenv,_wsetenv)( const CHAR_TYPE *name, const CHAR_TYPE
int rc;

if( name == NULL || *name == NULLCHAR || __F_NAME(strchr,wcschr)( name, STRING( '=' ) ) != NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

/*** Ensure variable is deleted if value == "" ***/
Expand Down
3 changes: 2 additions & 1 deletion bld/clib/file/c/utime.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ _WCRTLINK int __F_NAME(utime,_wutime)( CHAR_TYPE const *fname, struct utimbuf co
_dos_tms dostms;

if( _get_dos_tms( times, &dostms ) ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}
#ifdef __WATCOM_LFN__
if( _RWD_uselfn ) {
Expand Down
6 changes: 4 additions & 2 deletions bld/clib/handleio/c/__lseek.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ _WCRTLINK __int64 __lseeki64( int handle, __int64 offset, int origin )
} else {
#endif
if( offset > LONG_MAX || offset < LONG_MIN ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1LL );
}
pos = (unsigned long)__lseek( handle, offset, origin );
if( pos == INVALID_SET_FILE_POINTER ) {
Expand Down Expand Up @@ -117,7 +118,8 @@ _WCRTLINK __int64 __lseeki64( int handle, __int64 offset, int origin )
long pos;

if( offset > LONG_MAX || offset < LONG_MIN ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1LL );
}
pos = __lseek( handle, offset, origin );
if( pos == INVALID_SET_FILE_POINTER ) {
Expand Down
6 changes: 3 additions & 3 deletions bld/clib/handleio/c/setmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#endif
#include "rtdata.h"
#include "rterrno.h"
#include "seterrno.h"
#include "fileacc.h"
#include "rtcheck.h"
#include "iomode.h"
Expand All @@ -67,7 +66,7 @@ _WCRTLINK int _setmode( int handle, int mode )
}
old_mode = (iomode_flags & _BINARY) ? O_BINARY : O_TEXT;
if( mode != old_mode ) {
if( mode == O_BINARY || mode == O_TEXT ) {
if( mode == O_BINARY || mode == O_TEXT ) {
iomode_flags &= ~ _BINARY;
if( mode == O_BINARY ) {
iomode_flags |= _BINARY;
Expand All @@ -88,7 +87,8 @@ _WCRTLINK int _setmode( int handle, int mode )
}
_ReleaseFileH( handle );
} else {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
old_mode = -1;
}
}
return( old_mode );
Expand Down
7 changes: 4 additions & 3 deletions bld/clib/linux/c/cfspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stddef.h>
#include <termios.h>
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"


Expand Down Expand Up @@ -72,7 +71,8 @@ static int __valid_speed(speed_t speed)
_WCRTLINK int cfsetispeed(struct termios *tios, speed_t speed)
{
if(tios == NULL || !__valid_speed( speed )) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

tios->c_ispeed = speed;
Expand All @@ -83,7 +83,8 @@ _WCRTLINK int cfsetispeed(struct termios *tios, speed_t speed)
_WCRTLINK int cfsetospeed(struct termios *tios, speed_t speed)
{
if(tios == NULL || !__valid_speed( speed )) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

tios->c_ospeed = speed;
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/sem_getv.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
#include "futex.h"
#include "atomic.h"
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"


_WCRTLINK int sem_getvalue( sem_t *sem, int *value )
{
if( value == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}
*value = sem->value;
return( 0 );
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/sem_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "rtinit.h"
#include "exitwmsg.h"
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"


Expand Down Expand Up @@ -73,7 +72,8 @@ _WCRTLINK int sem_init( sem_t *sem, int pshared, unsigned int value )
return( -1 );
}
if( value > SEM_VALUE_MAX ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

// Debugging...
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/sem_post.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
#include "futex.h"
#include "atomic.h"
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"


_WCRTLINK int sem_post( sem_t *sem )
{
if( sem == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

while(sem->value < 0) __atomic_increment( &sem->value );
Expand Down
10 changes: 6 additions & 4 deletions bld/clib/linux/c/sem_wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "futex.h"
#include "atomic.h"
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"
#include "linuxsys.h"

Expand All @@ -58,7 +57,8 @@ int res;
struct timespec timer;

if( sem == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

timer.tv_sec = 0;
Expand All @@ -83,7 +83,8 @@ _WCRTLINK int sem_timedwait( sem_t *sem, const struct timespec *abstime )
struct timespec reltime;

if( sem == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

while( !__decrement_if_positive( &sem->value ) ) {
Expand Down Expand Up @@ -119,7 +120,8 @@ _WCRTLINK int sem_trywait( sem_t *sem )
int ret;

if( sem == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}
timer.tv_sec = 0;
timer.tv_nsec = 0;
Expand Down
12 changes: 7 additions & 5 deletions bld/clib/linux/c/sysconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <limits.h>
#include <sys/resource.h>
#include <sys/sysinfo.h>
#include "seterrno.h"
#include "linuxsys.h"


Expand Down Expand Up @@ -97,7 +96,8 @@ static int __sysconf_pages( int name )
#ifdef PAGE_SIZE
return( (int)( quantity / PAGE_SIZE ) );
#else
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
#endif
}

Expand Down Expand Up @@ -161,10 +161,11 @@ _WCRTLINK long sysconf( int name )
case _SC_PAGESIZE:
#ifdef PAGE_SIZE
ret = PAGE_SIZE;
break;
#else
return( __set_EINVAL() );
_RWD_errno = EINVAL;
ret = -1;
#endif
break;
case _SC_PHYS_PAGES:
case _SC_AVPHYS_PAGES:
ret = __sysconf_pages( name );
Expand Down Expand Up @@ -192,7 +193,8 @@ _WCRTLINK long sysconf( int name )
ret = (long)0;
break;
default:
return( __set_EINVAL() );
_RWD_errno = EINVAL;
break;
}

return( ret );
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/sysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "variety.h"
#include <sys/sysinfo.h>
#include "seterrno.h"
#include "linuxsys.h"


Expand All @@ -41,7 +40,8 @@ _WCRTLINK int sysinfo( struct sysinfo *__info )
syscall_res res;

if( __info == 0 ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

res = sys_call1( SYS_sysinfo, (u_long)__info );
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/tcgetatr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stddef.h>
#include <sys/ioctl.h>
#include <termios.h>
#include "seterrno.h"
#include "linuxsys.h"


Expand All @@ -44,7 +43,8 @@ _WCRTLINK int tcgetattr( int fd, struct termios *t )
syscall_res res;

if( t == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

/* OW's struct termios is the same (basically) as the kernel's
Expand Down
7 changes: 4 additions & 3 deletions bld/clib/linux/c/tcsetatr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stddef.h>
#include <sys/ioctl.h>
#include <termios.h>
#include "seterrno.h"
#include "linuxsys.h"


Expand All @@ -44,7 +43,8 @@ _WCRTLINK int tcsetattr( int fd, int actions, const struct termios *t )
int cmd;

if( t == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

switch( actions ) {
Expand All @@ -58,7 +58,8 @@ _WCRTLINK int tcsetattr( int fd, int actions, const struct termios *t )
cmd = TCSETSF;
break;
default:
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

return( ioctl( fd, cmd, t ) );
Expand Down
4 changes: 2 additions & 2 deletions bld/clib/linux/c/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <stdio.h>
#include <stddef.h>
#include <time.h>
#include "seterrno.h"
#include "linuxsys.h"


Expand All @@ -58,7 +57,8 @@ _WCRTLINK int timer_create( clockid_t __clk, struct sigevent *__sevp, timer_t *_
timer_t id;

if( __tmr == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

memset( &ksev, 0, sizeof( struct ksigevent ) );
Expand Down
2 changes: 0 additions & 2 deletions bld/clib/linux/objects.mif
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,3 @@
!inject writev.obj l32 lpc lmp

!include ../../../../objlist.mif

#vfork_postopts =-pcl -P -fo=.i
2 changes: 0 additions & 2 deletions bld/clib/math/objects.mif
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@
!inject rand.obj d16 d32 nt nta ntp ntm nvc nvl o16 o32 q16 q32 w16 w32 l32 lpc lmp rdu rdk

!include ../../../../objlist.mif

rand_postopts = -od
5 changes: 2 additions & 3 deletions bld/clib/posix/c/getline.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
#include "nw_lib.h"
#endif
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"


#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1)
#endif
Expand All @@ -62,7 +60,8 @@ _WCRTLINK ssize_t getdelim( char **s, size_t *n, int delim, FILE *fp )
char *buff;

if( n == NULL || s == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

buff = *s;
Expand Down
5 changes: 2 additions & 3 deletions bld/clib/posix/c/ptcreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@
#include <string.h>
#include "_ptint.h"
#include "rterrno.h"
#include "seterrno.h"
#include "thread.h"
#include "extfunc.h"


/* By default, allow OpenWatcom's thread library
* to handle this...
*/
Expand Down Expand Up @@ -101,7 +99,8 @@ _WCRTLINK int pthread_create( pthread_t *thread, const pthread_attr_t *attr,
struct __thread_pass *passed;

if( thread == NULL ) {
return( __set_EINVAL() );
_RWD_errno = EINVAL;
return( -1 );
}

stack_size = STACK_SIZE;
Expand Down
Loading

0 comments on commit 3afc882

Please sign in to comment.