krb5 commit: Visual Studio 2015 build fixes
Greg Hudson
ghudson at mit.edu
Mon Aug 10 13:23:27 EDT 2015
https://github.com/krb5/krb5/commit/a14739f2a2acac30a8aba6f8e9f8f5a34bd38d6e
commit a14739f2a2acac30a8aba6f8e9f8f5a34bd38d6e
Author: Thomas Sondergaard <thomas.sondergaard at karoshealth.com>
Date: Sat Aug 8 17:21:28 2015 +0200
Visual Studio 2015 build fixes
Define HAVE_VSNPRINTF for VS2015 or newer. Avoid putting constants
directly after string literals without whitespace, or the VS2015
compiler thinks it's a string suffix. Prefix the OVERFLOW identifier
in x-deltat.y (along with NUM and LONGNUM for consistency) to avoid a
conflict with math.h. Regenerate deltat.c.
[ghudson at mit.edu: squashed three commits and condensed commit
messages; avoid creating long lines]
ticket: 8231
src/include/win-mac.h | 3 ++
src/lib/krb5/krb/deltat.c | 80 +++++++++++++++++++++---------------------
src/lib/krb5/krb/x-deltat.y | 29 ++++++++-------
src/windows/leash/Leash.cpp | 4 +-
4 files changed, 60 insertions(+), 56 deletions(-)
diff --git a/src/include/win-mac.h b/src/include/win-mac.h
index 2d8090a..1994388 100644
--- a/src/include/win-mac.h
+++ b/src/include/win-mac.h
@@ -119,6 +119,9 @@ typedef _W64 int ssize_t;
#define NO_PASSWORD
#define HAVE_STRERROR
#define SYS_ERRLIST_DECLARED
+#if _MSC_VER >= 1900
+#define HAVE_VSNPRINTF
+#endif
/* Visual Studio 2012 errors out when we macroize keywords in C++ mode */
#ifndef __cplusplus
#define inline __inline
diff --git a/src/lib/krb5/krb/deltat.c b/src/lib/krb5/krb/deltat.c
index 0169da8..2c8b90b 100644
--- a/src/lib/krb5/krb/deltat.c
+++ b/src/lib/krb5/krb/deltat.c
@@ -153,7 +153,7 @@ static int mylex(int *intp, struct param *tmv);
static int yyparse(struct param *);
-#line 158 "deltat.c" /* yacc.c:339 */
+#line 157 "deltat.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -185,9 +185,9 @@ extern int yydebug;
# define YYTOKENTYPE
enum yytokentype
{
- NUM = 258,
- LONGNUM = 259,
- OVERFLOW = 260,
+ tok_NUM = 258,
+ tok_LONGNUM = 259,
+ tok_OVERFLOW = 260,
tok_WS = 261
};
#endif
@@ -197,10 +197,10 @@ extern int yydebug;
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
-#line 130 "x-deltat.y" /* yacc.c:355 */
+#line 129 "x-deltat.y" /* yacc.c:355 */
int val;
-#line 205 "deltat.c" /* yacc.c:355 */
+#line 204 "deltat.c" /* yacc.c:355 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
@@ -214,7 +214,7 @@ int yyparse (struct param *tmv);
/* Copy the second part of user declarations. */
-#line 219 "deltat.c" /* yacc.c:358 */
+#line 218 "deltat.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -512,8 +512,8 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 144, 144, 145, 145, 146, 146, 147, 147, 148,
- 149, 151, 152, 153, 154, 155, 156, 157, 158, 162,
+ 0, 143, 143, 144, 144, 145, 145, 146, 146, 147,
+ 148, 150, 151, 152, 153, 154, 155, 156, 157, 162,
163, 166, 167, 170, 171
};
#endif
@@ -523,8 +523,8 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "NUM", "LONGNUM", "OVERFLOW", "'-'",
- "':'", "'d'", "'h'", "'m'", "'s'", "tok_WS", "$accept", "start",
+ "$end", "error", "$undefined", "tok_NUM", "tok_LONGNUM", "tok_OVERFLOW",
+ "'-'", "':'", "'d'", "'h'", "'m'", "'s'", "tok_WS", "$accept", "start",
"posnum", "num", "ws", "wsnum", "deltat", "opt_hms", "opt_ms", "opt_s", YY_NULLPTR
};
#endif
@@ -1310,93 +1310,93 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 146 "x-deltat.y" /* yacc.c:1646 */
+#line 145 "x-deltat.y" /* yacc.c:1646 */
{ (yyval.val) = - (yyvsp[0].val); }
-#line 1317 "deltat.c" /* yacc.c:1646 */
+#line 1316 "deltat.c" /* yacc.c:1646 */
break;
case 9:
-#line 148 "x-deltat.y" /* yacc.c:1646 */
+#line 147 "x-deltat.y" /* yacc.c:1646 */
{ (yyval.val) = (yyvsp[0].val); }
-#line 1323 "deltat.c" /* yacc.c:1646 */
+#line 1322 "deltat.c" /* yacc.c:1646 */
break;
case 10:
-#line 149 "x-deltat.y" /* yacc.c:1646 */
+#line 148 "x-deltat.y" /* yacc.c:1646 */
{ YYERROR; }
-#line 1329 "deltat.c" /* yacc.c:1646 */
+#line 1328 "deltat.c" /* yacc.c:1646 */
break;
case 11:
-#line 151 "x-deltat.y" /* yacc.c:1646 */
+#line 150 "x-deltat.y" /* yacc.c:1646 */
{ DO ((yyvsp[-2].val), 0, 0, (yyvsp[0].val)); }
-#line 1335 "deltat.c" /* yacc.c:1646 */
+#line 1334 "deltat.c" /* yacc.c:1646 */
break;
case 12:
-#line 152 "x-deltat.y" /* yacc.c:1646 */
+#line 151 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, (yyvsp[-2].val), 0, (yyvsp[0].val)); }
-#line 1341 "deltat.c" /* yacc.c:1646 */
+#line 1340 "deltat.c" /* yacc.c:1646 */
break;
case 13:
-#line 153 "x-deltat.y" /* yacc.c:1646 */
+#line 152 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, 0, (yyvsp[-2].val), (yyvsp[0].val)); }
-#line 1347 "deltat.c" /* yacc.c:1646 */
+#line 1346 "deltat.c" /* yacc.c:1646 */
break;
case 14:
-#line 154 "x-deltat.y" /* yacc.c:1646 */
+#line 153 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, 0, 0, (yyvsp[-1].val)); }
-#line 1353 "deltat.c" /* yacc.c:1646 */
+#line 1352 "deltat.c" /* yacc.c:1646 */
break;
case 15:
-#line 155 "x-deltat.y" /* yacc.c:1646 */
+#line 154 "x-deltat.y" /* yacc.c:1646 */
{ DO ((yyvsp[-6].val), (yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); }
-#line 1359 "deltat.c" /* yacc.c:1646 */
+#line 1358 "deltat.c" /* yacc.c:1646 */
break;
case 16:
-#line 156 "x-deltat.y" /* yacc.c:1646 */
+#line 155 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, (yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); }
-#line 1365 "deltat.c" /* yacc.c:1646 */
+#line 1364 "deltat.c" /* yacc.c:1646 */
break;
case 17:
-#line 157 "x-deltat.y" /* yacc.c:1646 */
+#line 156 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, (yyvsp[-2].val), (yyvsp[0].val), 0); }
-#line 1371 "deltat.c" /* yacc.c:1646 */
+#line 1370 "deltat.c" /* yacc.c:1646 */
break;
case 18:
-#line 158 "x-deltat.y" /* yacc.c:1646 */
+#line 157 "x-deltat.y" /* yacc.c:1646 */
{ DO ( 0, 0, 0, (yyvsp[0].val)); }
-#line 1377 "deltat.c" /* yacc.c:1646 */
+#line 1376 "deltat.c" /* yacc.c:1646 */
break;
case 20:
#line 163 "x-deltat.y" /* yacc.c:1646 */
{ if (HOUR_NOT_OK((yyvsp[-2].val))) YYERROR;
DO_SUM((yyval.val), (yyvsp[-2].val) * 3600, (yyvsp[0].val)); }
-#line 1384 "deltat.c" /* yacc.c:1646 */
+#line 1383 "deltat.c" /* yacc.c:1646 */
break;
case 22:
#line 167 "x-deltat.y" /* yacc.c:1646 */
{ if (MIN_NOT_OK((yyvsp[-2].val))) YYERROR;
DO_SUM((yyval.val), (yyvsp[-2].val) * 60, (yyvsp[0].val)); }
-#line 1391 "deltat.c" /* yacc.c:1646 */
+#line 1390 "deltat.c" /* yacc.c:1646 */
break;
case 23:
#line 170 "x-deltat.y" /* yacc.c:1646 */
{ (yyval.val) = 0; }
-#line 1397 "deltat.c" /* yacc.c:1646 */
+#line 1396 "deltat.c" /* yacc.c:1646 */
break;
-#line 1401 "deltat.c" /* yacc.c:1646 */
+#line 1400 "deltat.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1664,14 +1664,14 @@ mylex(int *intp, struct param *tmv)
num = c - '0';
while (isdigit ((int) *P)) {
if (num > MAX_TIME / 10)
- return OVERFLOW;
+ return tok_OVERFLOW;
num *= 10;
if (num > MAX_TIME - (*P - '0'))
- return OVERFLOW;
+ return tok_OVERFLOW;
num += *P++ - '0';
}
*intp = num;
- return (P - orig_p > 2) ? LONGNUM : NUM;
+ return (P - orig_p > 2) ? tok_LONGNUM : tok_NUM;
case ' ':
case '\t':
case '\n':
diff --git a/src/lib/krb5/krb/x-deltat.y b/src/lib/krb5/krb/x-deltat.y
index 0fb0078..f9cc2bb 100644
--- a/src/lib/krb5/krb/x-deltat.y
+++ b/src/lib/krb5/krb/x-deltat.y
@@ -131,7 +131,7 @@ static int yyparse(struct param *);
%lex-param {struct param *tmv}
%define api.pure
-%token <val> NUM LONGNUM OVERFLOW
+%token <val> tok_NUM tok_LONGNUM tok_OVERFLOW
%token '-' ':' 'd' 'h' 'm' 's' tok_WS
%type <val> num opt_hms opt_ms opt_s wsnum posnum
@@ -141,20 +141,21 @@ static int yyparse(struct param *);
%%
start: deltat;
-posnum: NUM | LONGNUM ;
+posnum: tok_NUM | tok_LONGNUM ;
num: posnum | '-' posnum { $$ = - $2; } ;
ws: /* nothing */ | tok_WS ;
wsnum: ws num { $$ = $2; }
- | ws OVERFLOW { YYERROR; };
+ | ws tok_OVERFLOW { YYERROR; };
deltat:
- wsnum 'd' opt_hms { DO ($1, 0, 0, $3); }
- | wsnum 'h' opt_ms { DO ( 0, $1, 0, $3); }
- | wsnum 'm' opt_s { DO ( 0, 0, $1, $3); }
- | wsnum 's' { DO ( 0, 0, 0, $1); }
- | wsnum '-' NUM ':' NUM ':' NUM { DO ($1, $3, $5, $7); }
- | wsnum ':' NUM ':' NUM { DO ( 0, $1, $3, $5); }
- | wsnum ':' NUM { DO ( 0, $1, $3, 0); }
- | wsnum { DO ( 0, 0, 0, $1); } /* default to 's' */
+ wsnum 'd' opt_hms { DO ($1, 0, 0, $3); }
+ | wsnum 'h' opt_ms { DO ( 0, $1, 0, $3); }
+ | wsnum 'm' opt_s { DO ( 0, 0, $1, $3); }
+ | wsnum 's' { DO ( 0, 0, 0, $1); }
+ | wsnum '-' tok_NUM ':' tok_NUM ':' tok_NUM { DO ($1, $3, $5, $7); }
+ | wsnum ':' tok_NUM ':' tok_NUM { DO ( 0, $1, $3, $5); }
+ | wsnum ':' tok_NUM { DO ( 0, $1, $3, 0); }
+ | wsnum { DO ( 0, 0, 0, $1); }
+ /* default to 's' */
;
opt_hms:
@@ -208,14 +209,14 @@ mylex(int *intp, struct param *tmv)
num = c - '0';
while (isdigit ((int) *P)) {
if (num > MAX_TIME / 10)
- return OVERFLOW;
+ return tok_OVERFLOW;
num *= 10;
if (num > MAX_TIME - (*P - '0'))
- return OVERFLOW;
+ return tok_OVERFLOW;
num += *P++ - '0';
}
*intp = num;
- return (P - orig_p > 2) ? LONGNUM : NUM;
+ return (P - orig_p > 2) ? tok_LONGNUM : tok_NUM;
case ' ':
case '\t':
case '\n':
diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp
index beead0c..f4e7493 100644
--- a/src/windows/leash/Leash.cpp
+++ b/src/windows/leash/Leash.cpp
@@ -853,8 +853,8 @@ BOOL CLeashApp::InitDLLs()
!LoadFuncs(KERB5_PPROFILE_DLL, profile_fi, 0, 0, 1, 0, 0))
{
MessageBox(hwnd,
- "Unexpected error while loading "KERB5_PPROFILE_DLL".\n"
- "Kerberos 5 functionality will be disabled.\n",
+ "Unexpected error while loading " KERB5_PPROFILE_DLL "."
+ "\nKerberos 5 functionality will be disabled.\n",
"Error", MB_OK);
AfxFreeLibrary(m_hKrb5ProfileDLL);
m_hKrb5ProfileDLL = 0;
More information about the cvs-krb5
mailing list