Skip to content

Commit

Permalink
Exclude redirection assert on C89 builds
Browse files Browse the repository at this point in the history
As building under C89 is something of a "stunt" more than anything,
the smart console features have been limited to C99 builds or higher,
in order to make that code more maintainable and accessible.  C89
builds will only have whatever I/O the read() and write() functions
give you on stdin and stdout by default--which is typically junk.

However, the 32-bit Windows build had been C89, because it said the
standard was "C" in an era where the old gcc had not been bumped to
consider C99 or later the "standard".  This meant that it hit an
assert which was only valid in redirected input or output situations,
where the terminal was inactive.  But since the C89 mode uses that
always, it should not assert.

This guards the assert to only happen in non-smart-console builds.
It also switches over the 32-bit Windows test build to use C99, due
to the odds that people are going to continue downloading this despite
my pleading not to (because the builds exist to test breadth of the
build matrix, not to please any user in particular).  And when they
download it they will complain that it doesn't have smart console
features.
  • Loading branch information
hostilefork committed Apr 7, 2020
1 parent 2de2bf2 commit 017e385
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ matrix:
- OS_ID=0.3.1
- DEBUG=none
- CROSS_PREFIX=i686-w64-mingw32- # trailing hyphen is intentional
- STANDARD=c
- STANDARD=c99
- RIGOROUS=yes
- STATIC=yes
- TCC=i386-win32-tcc
Expand Down Expand Up @@ -441,7 +441,7 @@ matrix:
- OS_ID=0.3.40
- DEBUG=asserts
- CROSS_PREFIX=x86_64-w64-mingw32- # trailing hyphen is intentional
- STANDARD=c
- STANDARD=c99
- RIGOROUS=yes
- STATIC=yes
- TCC=x86_64-win32-tcc
Expand Down
4 changes: 3 additions & 1 deletion extensions/stdio/stdio-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ DEVICE_CMD Write_IO(REBREQ *io)
// answer for C89 builds on arbitrarily limited platforms, vs.
// catering to it here.
//
assert(Redir_Inp or Redir_Out);
#if defined(REBOL_SMART_CONSOLE)
assert(Redir_Inp or Redir_Out); // should have used smarts otherwise
#endif

if (req->modes & RFM_TEXT) {
//
Expand Down

0 comments on commit 017e385

Please sign in to comment.