New -pedantic option for lcc-win32

J

jacob navia

Due to popular demand (specially from Mr Heathfield), I have
introduced a

-pedantic

compiler flag, that will be as the -ansic option but stricter.

This flag will make

_stdcall

no longer a recognized part of the language.

Anonymous structures will not be accepted either.

jacob
 
R

Richard Heathfield

jacob navia said:
Due to popular demand (specially from Mr Heathfield),

I demanded no such thing. All I said was that lcc-win32 is not a conforming
C implementation. Whether lcc-win32 is conforming is of little concern to
me, since I no longer include it in my resources list, and no longer
recommend it in IRC - both of which are direct consequences of Mr Navia's
determination to treat comp.lang.c as an advertising hoarding.
I have introduced a -pedantic compiler flag, that will be as the -ansic
option but stricter.

That's rather cold comfort for those who relied on Mr Navia's /existing/
implementation being conforming. Still, at least it shows that he is able,
on occasion, to recognise the importance of conformance, and that's a step
in the right direction.
This flag will make _stdcall no longer a recognized part of the language.

_stdcall has *never* been a recognised part of the C language.
Anonymous structures will not be accepted either.

And what other conformance issues lie dormant within lcc-win32? Only time
will tell.
 
M

Malcolm

jacob navia said:
Due to popular demand (specially from Mr Heathfield), I have
introduced a

-pedantic

compiler flag, that will be as the -ansic option but stricter.

This flag will make

_stdcall

no longer a recognized part of the language.

Anonymous structures will not be accepted either.
What about slash slash comments?
I decided a while back that surely these were sufficiently well established
to regard as standard, only to get an MPI compiler with distinctly
old-fashioned ideas.
 
K

Keith Thompson

Malcolm said:
What about slash slash comments?
I decided a while back that surely these were sufficiently well established
to regard as standard, only to get an MPI compiler with distinctly
old-fashioned ideas.

That's a different issue. "//" comments are legal in C99, but illegal
in C90. _stdcall and anonymous structures are not legal in *any* C
standard.

<OT>
I think lcc-win32 has an option that causes it to attempt to conform
to C90 and another that causes it to attempt to conform to C99 (though
last I heard there are some C99 features that aren't yet implemented).
If these options are done properly, then it will reject "//" comments
in C90 mode and accept them in C99 mode.
</OT>
 
R

Richard Heathfield

Keith Thompson said:
_stdcall and anonymous structures are not legal in *any* C
standard.

_stdcall is in implementation namespace, so it's perfectly legal for C
implementations to use it for any reasonable purpose they like. For
example, one implementation might use it as a prefix for a function name,
with the intent that any function prefixed in such a way is run remotely
over a phone connection ("subscriber trunk dialling call").

Anonymous structures, though, are a syntax error, and a diagnostic is
required.
 
B

Ben Pfaff

Richard Heathfield said:
Anonymous structures, though, are a syntax error, and a diagnostic is
required.

You can fake them, though, if you have sufficiently poor taste.
For example, a quick grep in my system's implementation headers
found this abortion:

typedef struct siginfo {
int si_signo;
int si_errno;
int si_code;

union {
int _pad[SI_PAD_SIZE];

/* kill() */
struct {
pid_t _pid; /* sender's pid */
__ARCH_SI_UID_T _uid; /* sender's uid */
} _kill;

/* POSIX.1b timers */
struct {
timer_t _tid; /* timer id */
int _overrun; /* overrun count */
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
sigval_t _sigval; /* same as below */
int _sys_private; /* not to be passed to user */
} _timer;

/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
__ARCH_SI_UID_T _uid; /* sender's uid */
sigval_t _sigval;
} _rt;

/* SIGCHLD */
struct {
pid_t _pid; /* which child */
__ARCH_SI_UID_T _uid; /* sender's uid */
int _status; /* exit code */
clock_t _utime;
clock_t _stime;
} _sigchld;

/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct {
void __user *_addr; /* faulting insn/memory ref. */
#ifdef __ARCH_SI_TRAPNO
int _trapno; /* TRAP # which caused the signal */
#endif
} _sigfault;

/* SIGPOLL */
struct {
__ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG *
/
int _fd;
} _sigpoll;
} _sifields;
} siginfo_t;

#endif

/*
* How these fields are to be accessed.
*/
#define si_pid _sifields._kill._pid
#define si_uid _sifields._kill._uid
#define si_tid _sifields._timer._tid
#define si_overrun _sifields._timer._overrun
#define si_sys_private _sifields._timer._sys_private
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
#define si_value _sifields._rt._sigval
#define si_int _sifields._rt._sigval.sival_int
#define si_ptr _sifields._rt._sigval.sival_ptr
#define si_addr _sifields._sigfault._addr
#ifdef __ARCH_SI_TRAPNO
#define si_trapno _sifields._sigfault._trapno
#endif
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd

On Unix-like systems you can probably find several like this
using a command similar to this, which is what I used:
grep '#define[[:space:]]\+[a-z]\+_[^.]*\.' /usr/include -r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top