Skip to content

Commit

Permalink
Prefer stdbool.h over mybool.h
Browse files Browse the repository at this point in the history
Since 5fa82fb (make: Force use of GNU 99 C standard, 2015-08-10) we
require a C99 compiler on automake/autoconf platforms.

And since 4da1666 (build: Arrange cpp '-Dbool=int', '-Dtrue=1', and
'-Dfalse=0' flags, 2015-10-02) we either have use stdbool.h or an
equivalent workaround.

Therefore only platforms without support for stdbool and not using
automake/autoconf still require an equivalent for mybool.h.
Add this equivalent in e_msoft.h for earlier version than Visual Studio
2013.

In all other places use the default type bool and true or false.

Signed-off-by: Thomas Braun <[email protected]>
  • Loading branch information
t-b committed Sep 24, 2016
1 parent 07541c5 commit ce99080
Show file tree
Hide file tree
Showing 155 changed files with 3,457 additions and 3,481 deletions.
14 changes: 7 additions & 7 deletions main/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static char* nextFileLine (FILE* const fp)
return result;
}

static boolean isCommentLine (char* line)
static bool isCommentLine (char* line)
{
while (isspace(*line))
++line;
Expand All @@ -165,7 +165,7 @@ static boolean isCommentLine (char* line)
static char* nextFileLineSkippingComments (FILE* const fp)
{
char* result;
boolean comment;
bool comment;

do
{
Expand Down Expand Up @@ -223,7 +223,7 @@ extern Arguments* argNewFromLineFile (FILE* const fp)
Arguments* result = xMalloc (1, Arguments);
memset (result, 0, sizeof (Arguments));
result->type = ARG_FILE;
result->lineMode = TRUE;
result->lineMode = true;
result->u.fileArgs.fp = fp;
result->item = nextFileString (result, result->u.fileArgs.fp);
return result;
Expand All @@ -236,22 +236,22 @@ extern char *argItem (const Arguments* const current)
return current->item;
}

extern boolean argOff (const Arguments* const current)
extern bool argOff (const Arguments* const current)
{
Assert (current != NULL);
return (boolean) (current->item == NULL);
return (bool) (current->item == NULL);
}

extern void argSetWordMode (Arguments* const current)
{
Assert (current != NULL);
current->lineMode = FALSE;
current->lineMode = false;
}

extern void argSetLineMode (Arguments* const current)
{
Assert (current != NULL);
current->lineMode = TRUE;
current->lineMode = true;
}

extern void argForth (Arguments* const current)
Expand Down
4 changes: 2 additions & 2 deletions main/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef struct sArgs {
} fileArgs;
} u;
char* item;
boolean lineMode;
bool lineMode;
} Arguments;

/*
Expand All @@ -48,7 +48,7 @@ extern Arguments* argNewFromArgv (char* const* const argv);
extern Arguments* argNewFromFile (FILE* const fp);
extern Arguments* argNewFromLineFile (FILE* const fp);
extern char *argItem (const Arguments* const current);
extern boolean argOff (const Arguments* const current);
extern bool argOff (const Arguments* const current);
extern void argSetWordMode (Arguments* const current);
extern void argSetLineMode (Arguments* const current);
extern void argForth (Arguments* const current);
Expand Down
6 changes: 3 additions & 3 deletions main/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ extern void debugPutc (const int level, const int c)
}
}

extern void debugParseNest (const boolean increase, const unsigned int level)
extern void debugParseNest (const bool increase, const unsigned int level)
{
debugPrintf (DEBUG_PARSE, "<*%snesting:%d*>", increase ? "++" : "--", level);
}

extern void debugCppNest (const boolean begin, const unsigned int level)
extern void debugCppNest (const bool begin, const unsigned int level)
{
debugPrintf (DEBUG_CPP, "<*cpp:%s level %d*>", begin ? "begin":"end", level);
}

extern void debugCppIgnore (const boolean ignore)
extern void debugCppIgnore (const bool ignore)
{
debugPrintf (DEBUG_CPP, "<*cpp:%s ignore*>", ignore ? "begin":"end");
}
Expand Down
6 changes: 3 additions & 3 deletions main/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ enum eDebugLevels {
extern void lineBreak (void);
extern void debugPrintf (const enum eDebugLevels level, const char *const format, ...) CTAGS_ATTR_PRINTF (2, 3);
extern void debugPutc (const int level, const int c);
extern void debugParseNest (const boolean increase, const unsigned int level);
extern void debugCppNest (const boolean begin, const unsigned int level);
extern void debugCppIgnore (const boolean ignore);
extern void debugParseNest (const bool increase, const unsigned int level);
extern void debugCppNest (const bool begin, const unsigned int level);
extern void debugCppIgnore (const bool ignore);
extern void debugEntry (const tagEntryInfo *const tag);
extern void debugAssert (const char *assertion, const char *file, unsigned int line, const char *function) attr__noreturn;

Expand Down
7 changes: 7 additions & 0 deletions main/e_msoft.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
# endif
# define findfirst_t intptr_t

#if (_MSC_VER >= 1800) // Visual Studio 2013 or newer
#define HAVE_STDBOOL_H 1
#else
typedef enum { false, true } bool;
#endif

# ifndef _CRT_SECURE_NO_DEPRECATE
# define _CRT_SECURE_NO_DEPRECATE 1
# endif
Expand All @@ -51,6 +57,7 @@
#elif defined (__MINGW32__)

# include <_mingw.h>
# define HAVE_STDBOOL_H 1
# define HAVE_DIR_H 1
# define HAVE_DIRENT_H 1
# define HAVE__FINDFIRST 1
Expand Down
Loading

0 comments on commit ce99080

Please sign in to comment.