Discussion:
[9fans] X11
(too old to reply)
Charles Forsyth
2013-02-28 14:21:08 UTC
Permalink
ANSI C has a "_Noreturn" attribute that I started to implement,
but I think I might fall back to a #pragma, which would be quicker to do.
I have rebuilt equis with the change in ape's select
and it seems to work fine (tested with xlock and xterm only).
this was not quite straightforward due to changes in ape, and
the compiler becomming a little stricter.
On this subject, what is the general feeling on integer
type'ed functions which call exit() before falling off the
end of the function?
This is fairly common in X11 and I have just added a return 0 on
the end to push the code through the compiler, but should the
compiler be taught about this case?
if so, it gets a bit nasty as this feature is named
exit() under ape and exits() in native plan9.
Personally I think falling of the end of a function
is a bug and should be fixed, but perhaps it should
just be a warning rather than an error to make
building foreign code simpler.
-Steve
dexen deVries
2013-02-28 17:19:59 UTC
Permalink
Post by Charles Forsyth
ANSI C has a "_Noreturn" attribute that I started to implement,
but I think I might fall back to a #pragma, which would be quicker to do.
another quick hack:

#define exit(status) do { exit(status); return 0; } while (0)

with do{}while() guarding against treating it as an expression.
--
dexen deVries

[[[↓][→]]]
Joel C. Salomon
2013-02-28 18:10:15 UTC
Permalink
Post by dexen deVries
#define exit(status) do { exit(status); return 0; } while (0)
What does kenc do with a void function attempting to return 0?

—Joel
Steve Simon
2013-02-28 19:46:41 UTC
Permalink
Post by Joel C. Salomon
What does kenc do with a void function attempting to return 0?
t.c:6 incompatible types: "VOID" and "INT" for op "RETURN"

-Steve
Federico G. Benavento
2013-03-01 04:11:52 UTC
Permalink
thanks steve
Post by Steve Simon
Post by Joel C. Salomon
What does kenc do with a void function attempting to return 0?
t.c:6 incompatible types: "VOID" and "INT" for op "RETURN"
-Steve
--
Federico G. Benavento
Comeau At9Fans
2013-03-01 13:05:27 UTC
Permalink
Post by Joel C. Salomon
Post by dexen deVries
#define exit(status) do { exit(status); return 0; } while (0)
What does kenc do with a void function attempting to return 0?
incompatible types: "VOID" and "INT" for op "RETURN"

There isn't a perfect solution considering existing code etc but
similarly can be diagnosed in Steve's case, more along the lines of:

warning: missing return statement at end of non-void function "foo"

--
Greg Comeau / 4.3.10.1 with C++0xisms now in beta!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

Jeff Sickel
2013-02-28 23:02:52 UTC
Permalink
I've submitted a patch, ape-select, that just removes the
offending EBADF. If there's a desire to up the FD_SETSIZE
to 1024 like everyone else, we should address that as a
separate patch and modernize the <sys/select.h> in the
process.

-jas
Charles Forsyth
2013-02-28 23:13:10 UTC
Permalink
Post by Jeff Sickel
that just removes the
offending EBADF
it should generate EBADF for any bit set in any of the fd_sets when that
bit doesn't correspond to an open file descriptor.
the mistake was producing EBADF on a very specific condition associated
with an *open* file descriptor
Loading...