From ac883b697205e2392998606e49cf8909ce3d6ce5 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 15 Jun 2018 00:00:46 +0000 Subject: [PATCH] FreeBSD 11: Fix clang (v6) builds While CDE builds fine with gcc6 on FreeBSD 11, the default clang build was broken in a few places. This commit allows CDE to build now using the default clang 6 system compiler. --- .../bin/tt_type_comp/frozen.mp_types_gram.C | 24 +++++++++---------- .../tt/bin/tt_type_comp/frozen.mp_types_lex.C | 14 ++--------- .../dtmail/libDtMail/Common/FileShare.C | 2 +- .../dtmail/libDtMail/RFC/RFCMailBox.C | 20 ++++++++-------- 4 files changed, 25 insertions(+), 35 deletions(-) diff --git a/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_gram.C b/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_gram.C index 506d2ff2..6b1ac365 100644 --- a/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_gram.C +++ b/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_gram.C @@ -511,7 +511,7 @@ int _Tt_types_table::yyparse(void) int _Tt_types_table::yyparse() #endif { - register YYSTYPE *yypvt; /* top of value stack for $vars */ + YYSTYPE *yypvt; /* top of value stack for $vars */ #if defined(__cplusplus) || defined(lint) /* @@ -550,10 +550,10 @@ int _Tt_types_table::yyparse() #endif { - register YYSTYPE *yy_pv; /* top of value stack */ - register int *yy_ps; /* top of state stack */ - register int yy_state; /* current state */ - register int yy_n; /* internal state number info */ + YYSTYPE *yy_pv; /* top of value stack */ + int *yy_ps; /* top of state stack */ + int yy_state; /* current state */ + int yy_n; /* internal state number info */ goto yystack; /* moved from 6 lines above to here to please C++ */ /* @@ -591,7 +591,7 @@ int _Tt_types_table::yyparse() */ if ( yydebug ) { - register int yy_i; + int yy_i; printf( "State %d, token ", yy_state ); if ( yychar == 0 ) @@ -675,7 +675,7 @@ int _Tt_types_table::yyparse() #if YYDEBUG if ( yydebug && yytmp ) { - register int yy_i; + int yy_i; printf( "Received token " ); if ( yychar == 0 ) @@ -717,7 +717,7 @@ int _Tt_types_table::yyparse() #if YYDEBUG if ( yydebug && yytmp ) { - register int yy_i; + int yy_i; printf( "Received token " ); if ( yychar == 0 ) @@ -744,7 +744,7 @@ int _Tt_types_table::yyparse() ** look through exception table */ { - register int *yyxi = yyexca; + int *yyxi = yyexca; while ( ( *yyxi != -1 ) || ( yyxi[1] != yy_state ) ) @@ -830,7 +830,7 @@ int _Tt_types_table::yyparse() */ if ( yydebug ) { - register int yy_i; + int yy_i; printf( "Error recovery discards " ); if ( yychar == 0 ) @@ -879,7 +879,7 @@ int _Tt_types_table::yyparse() /* ** Look in goto table for next state ** Sorry about using yy_state here as temporary - ** register variable, but why not, if it works... + ** variable, but why not, if it works... ** If yyr2[ yy_n ] doesn't have the low order bit ** set, then there is no action to be done for ** this reduction. So, no saving & unsaving of @@ -890,7 +890,7 @@ int _Tt_types_table::yyparse() */ { /* length of production doubled with extra bit */ - register int yy_len = yyr2[ yy_n ]; + int yy_len = yyr2[ yy_n ]; if ( !( yy_len & 01 ) ) { diff --git a/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_lex.C b/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_lex.C index 2c0e8e60..d6d3e8a4 100644 --- a/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_lex.C +++ b/cde/lib/tt/bin/tt_type_comp/frozen.mp_types_lex.C @@ -65,16 +65,6 @@ extern "C" { } #endif -#ifdef __cplusplus -extern "C" { -#endif -#if !defined(__linux__) - void exit(int); -#endif -#ifdef __cplusplus -} -#endif - #endif # define yymore() (yymorfg=1) #ifndef __cplusplus @@ -1109,8 +1099,8 @@ int _Tt_types_table::yylook(void) int _Tt_types_table::yylook() #endif { - register struct yysvf *yystate, **lsp; - register struct yywork *yyt; + struct yysvf *yystate, **lsp; + struct yywork *yyt; struct yysvf *yyz; int yych, yyfirst; struct yywork *yyr; diff --git a/cde/programs/dtmail/libDtMail/Common/FileShare.C b/cde/programs/dtmail/libDtMail/Common/FileShare.C index c87706fa..027c7761 100644 --- a/cde/programs/dtmail/libDtMail/Common/FileShare.C +++ b/cde/programs/dtmail/libDtMail/Common/FileShare.C @@ -353,7 +353,7 @@ FileShare::lockFile(DtMailEnv & error) if (isModified(error) == DTM_FALSE) { break; } else { - if (time((time_t)NULL) - t_start > FileShareTimeout) { + if (time(NULL) - t_start > FileShareTimeout) { // time out! error.setError(DTME_OtherOwnsWrite); return; diff --git a/cde/programs/dtmail/libDtMail/RFC/RFCMailBox.C b/cde/programs/dtmail/libDtMail/RFC/RFCMailBox.C index e9d31311..9afb24d8 100644 --- a/cde/programs/dtmail/libDtMail/RFC/RFCMailBox.C +++ b/cde/programs/dtmail/libDtMail/RFC/RFCMailBox.C @@ -204,7 +204,7 @@ void HexDump(FILE *pfp, char *pmsg, unsigned char *pbufr, int plen, int plimit) GET_DUMPFILE_NAME(dumpfilename); pfp_r = fopen(dumpfilename, "a"); - const time_t clockTime = (const time_t) time((time_t *)0); + const time_t clockTime = (const time_t) time(NULL); memset((void*) &ctime_buf, 0, sizeof(_Xctimeparams)); fprintf(pfp_r, "--------------------- pid=%ld %s", (long)getpid(), _XCtime(&clockTime, ctime_buf)); @@ -684,7 +684,7 @@ RFCMailBox::append(DtMailEnv &error, char *buf, int len) mailboxAccessHide("append"); else { - time_t now = time((time_t) NULL); + time_t now = time(NULL); mailboxAccessShow(now, "append"); } @@ -3675,7 +3675,7 @@ RFCMailBox::generateUniqueLockId(void) if (sysinfo(SI_HW_SERIAL, (char *)hwserialbuf, sizeof(hwserialbuf)-1) == -1) #endif strcpy(hwserialbuf, "dtmail"); - (void) sprintf(theId, "%08ld%08ld%s\0", (long)getpid(), (long)time((time_t *)0), hwserialbuf); + (void) sprintf(theId, "%08ld%08ld%s\0", (long)getpid(), (long)time(NULL), hwserialbuf); assert(strlen(theId)