This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via 7ebc06fb021353bde23a2ae858f9e3785ec5b720 (commit) via e78fc81d4a161c88ddd11366e261d18033dd9bf7 (commit) via e08f02b9282dc8e09bfb49955806f82e1d48415c (commit) via 689ce111a8bc20b3dfc60326b65fc03e918c9679 (commit) via 406f397e8b5524107457cc2d70bd22878350e9e1 (commit) via dd5c54600b6f651898925bfd9ec4406ccfc7be95 (commit) via 185bcface43d95b062c5be16321ae9aa59ed0057 (commit) via 71d99e156badae2e12eca56b2b2fa4059cf67cf9 (commit) via 2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 (commit) via 1385b4b1138eeebd79b6dab940915b509a82cb5f (commit) via 1bcc0f3678daea6bb7f999ebded1eab471b32e28 (commit) via dee7bafb13c654a2d62196451f013ef40dd2120f (commit) via 5f431789a9b7dfcd3e350d08fb71521999d2be5c (commit) from 328410f26b86a7446035fa922a1ffb066b53bcf8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ebc06fb021353bde23a2ae858f9e3785ec5b720 commit 7ebc06fb021353bde23a2ae858f9e3785ec5b720 Merge: e78fc81 406f397 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jul 17 11:14:42 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jul 17 07:14:48 2018 -0400 Merge topic 'math-err' 406f397e8b math: Restore toleration of unexpected characters in an expression dd5c54600b cmExprParserHelper: Simplify error state tracking 185bcface4 cmExprParserHelper: Remove some unused code Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2218 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e78fc81d4a161c88ddd11366e261d18033dd9bf7 commit e78fc81d4a161c88ddd11366e261d18033dd9bf7 Merge: e08f02b 71d99e1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jul 17 11:13:12 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jul 17 07:13:18 2018 -0400 Merge topic 'FindProtobuf-upstream-impl' 71d99e156b Protobuf: restore previous output directory 2ae2d0bd3e Protobuf: restore 'DESCRIPTORS' support 1385b4b113 Protobuf: restore 'PROTOBUF_IMPORT_DIRS' check 1bcc0f3678 Protobuf: use upstream implementation to generate cpp and python files Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2212 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e08f02b9282dc8e09bfb49955806f82e1d48415c commit e08f02b9282dc8e09bfb49955806f82e1d48415c Merge: 689ce11 5f43178 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jul 17 11:12:23 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jul 17 07:12:29 2018 -0400 Merge topic 'hex_file' 5f431789a9 Use isxdigit() to determine if a character is a hex digit Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2213 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=689ce111a8bc20b3dfc60326b65fc03e918c9679 commit 689ce111a8bc20b3dfc60326b65fc03e918c9679 Merge: 328410f dee7baf Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Jul 17 11:11:32 2018 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Jul 17 07:11:38 2018 -0400 Merge topic 'FindOpenCL-arch-paths' dee7bafb13 FindOpenCL: Search per-architecture path suffixes on UNIX Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2215 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=406f397e8b5524107457cc2d70bd22878350e9e1 commit 406f397e8b5524107457cc2d70bd22878350e9e1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jul 16 13:06:29 2018 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 14:46:43 2018 -0400 math: Restore toleration of unexpected characters in an expression Prior to commit 7c4c13ffef (math: Reject unexpected expression input explicitly, 2018-05-18) we ignored unexpected characters in an expression that otherwise can be parsed. In order to preserve compatibility with projects that accidentally used this, convert the error to a warning. diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 1548daf..cb24687 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -1050,7 +1050,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -{return exp_UNEXPECTED;} +{ yyextra->UnexpectedChar(yytext[0]); } YY_BREAK case 18: YY_RULE_SETUP diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 87237d1..2197c2a 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -58,6 +58,6 @@ Modify cmExprLexer.cxx: ">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } -. {return exp_UNEXPECTED;} +. { yyextra->UnexpectedChar(yytext[0]); } %% diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index cbb8078..fbc3628 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -157,8 +157,7 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271, - exp_UNEXPECTED = 272 + exp_NUMBER = 271 }; #endif /* Tokens. */ @@ -176,7 +175,6 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 -#define exp_UNEXPECTED 272 /* Value type. */ @@ -188,7 +186,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 192 "cmExprParser.cxx" /* yacc.c:358 */ +#line 190 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -433,7 +431,7 @@ union yyalloc #define YYLAST 30 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 18 +#define YYNTOKENS 17 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 10 /* YYNRULES -- Number of rules. */ @@ -444,7 +442,7 @@ union yyalloc /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 272 +#define YYMAXUTOK 271 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -480,16 +478,16 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17 + 15, 16 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 75, 75, 80, 83, 88, 91, 96, 99, 104, - 107, 110, 115, 118, 121, 126, 129, 132, 138, 143, - 146, 149, 154, 157 + 0, 74, 74, 79, 82, 87, 90, 95, 98, 103, + 106, 109, 114, 117, 120, 125, 128, 131, 137, 142, + 145, 148, 153, 156 }; #endif @@ -501,9 +499,8 @@ static const char *const yytname[] = "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES", "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT", "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR", - "exp_NOT", "exp_NUMBER", "\"character\"", "$accept", "start", "exp", - "bitwiseor", "bitwisexor", "bitwiseand", "shift", "term", "unary", - "factor", YY_NULLPTR + "exp_NOT", "exp_NUMBER", "$accept", "start", "exp", "bitwiseor", + "bitwisexor", "bitwiseand", "shift", "term", "unary", "factor", YY_NULLPTR }; #endif @@ -513,7 +510,7 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272 + 265, 266, 267, 268, 269, 270, 271 }; # endif @@ -583,18 +580,18 @@ static const yytype_int8 yycheck[] = symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 10, 16, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 26, 26, 20, 0, 12, 14, - 13, 8, 9, 3, 4, 5, 6, 7, 11, 21, - 22, 23, 24, 24, 25, 25, 26, 26, 26 + 0, 3, 4, 10, 16, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 25, 25, 19, 0, 12, 14, + 13, 8, 9, 3, 4, 5, 6, 7, 11, 20, + 21, 22, 23, 23, 24, 24, 25, 25, 25 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 18, 19, 20, 20, 21, 21, 22, 22, 23, - 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, - 26, 26, 27, 27 + 0, 17, 18, 19, 19, 20, 20, 21, 21, 22, + 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, + 25, 25, 26, 26 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -1285,186 +1282,186 @@ yyreduce: switch (yyn) { case 2: -#line 75 "cmExprParser.y" /* yacc.c:1646 */ +#line 74 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1290 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 80 "cmExprParser.y" /* yacc.c:1646 */ +#line 79 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1298 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 83 "cmExprParser.y" /* yacc.c:1646 */ +#line 82 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1306 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 88 "cmExprParser.y" /* yacc.c:1646 */ +#line 87 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1314 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 91 "cmExprParser.y" /* yacc.c:1646 */ +#line 90 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1322 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 96 "cmExprParser.y" /* yacc.c:1646 */ +#line 95 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1330 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 99 "cmExprParser.y" /* yacc.c:1646 */ +#line 98 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1338 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 104 "cmExprParser.y" /* yacc.c:1646 */ +#line 103 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1346 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 107 "cmExprParser.y" /* yacc.c:1646 */ +#line 106 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1354 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 110 "cmExprParser.y" /* yacc.c:1646 */ +#line 109 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1362 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 115 "cmExprParser.y" /* yacc.c:1646 */ +#line 114 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1370 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 118 "cmExprParser.y" /* yacc.c:1646 */ +#line 117 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1378 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 121 "cmExprParser.y" /* yacc.c:1646 */ +#line 120 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1386 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 126 "cmExprParser.y" /* yacc.c:1646 */ +#line 125 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1394 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 129 "cmExprParser.y" /* yacc.c:1646 */ +#line 128 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1402 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 132 "cmExprParser.y" /* yacc.c:1646 */ +#line 131 "cmExprParser.y" /* yacc.c:1646 */ { if (yyvsp[0].Number == 0) { throw std::overflow_error("divide by zero"); } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1413 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 137 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1421 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 143 "cmExprParser.y" /* yacc.c:1646 */ +#line 142 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1429 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 146 "cmExprParser.y" /* yacc.c:1646 */ +#line 145 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1437 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 148 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1445 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 154 "cmExprParser.y" /* yacc.c:1646 */ +#line 153 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1453 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 157 "cmExprParser.y" /* yacc.c:1646 */ +#line 156 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1465 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1694,7 +1691,7 @@ yyreturn: #endif return yyresult; } -#line 162 "cmExprParser.y" /* yacc.c:1906 */ +#line 161 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index 510daaa..921b31d 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -64,7 +64,6 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); %token exp_XOR; %token exp_NOT; %token exp_NUMBER; -%token exp_UNEXPECTED "character"; /*-------------------------------------------------------------------------*/ /* grammar */ diff --git a/Source/LexerParser/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h index 00be4e9..84b2bbd 100644 --- a/Source/LexerParser/cmExprParserTokens.h +++ b/Source/LexerParser/cmExprParserTokens.h @@ -58,8 +58,7 @@ extern int cmExpr_yydebug; exp_AND = 268, exp_XOR = 269, exp_NOT = 270, - exp_NUMBER = 271, - exp_UNEXPECTED = 272 + exp_NUMBER = 271 }; #endif /* Tokens. */ @@ -77,7 +76,6 @@ extern int cmExpr_yydebug; #define exp_XOR 269 #define exp_NOT 270 #define exp_NUMBER 271 -#define exp_UNEXPECTED 272 /* Value type. */ diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 821667b..8d3dad7 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -101,6 +101,15 @@ void cmExprParserHelper::Error(const char* str) this->ErrorString = ostr.str(); } +void cmExprParserHelper::UnexpectedChar(char c) +{ + unsigned long pos = static_cast<unsigned long>(this->InputBufferPos); + std::ostringstream ostr; + ostr << "Unexpected character in expression at position " << pos << ": " << c + << "\n"; + this->WarningString += ostr.str(); +} + void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 15e8f3e..42c460a 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -32,6 +32,10 @@ public: const char* GetError() { return this->ErrorString.c_str(); } + void UnexpectedChar(char c); + + std::string const& GetWarning() const { return this->WarningString; } + private: std::string::size_type InputBufferPos; std::string InputBuffer; @@ -47,6 +51,7 @@ private: const char* FileName; long FileLine; std::string ErrorString; + std::string WarningString; }; #define YYSTYPE cmExprParserHelper::ParserType diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 5d1b099..a50e5fc 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -5,6 +5,7 @@ #include "cmExprParserHelper.h" #include "cmMakefile.h" #include "cm_kwiml.h" +#include "cmake.h" #include <stdio.h> @@ -101,6 +102,11 @@ bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args) } sprintf(buffer, fmt, helper.GetResult()); + std::string const& w = helper.GetWarning(); + if (!w.empty()) { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w); + } + this->Makefile->AddDefinition(outputVariable, buffer); return true; } diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt index 18ac9f7..9e73ed5 100644 --- a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt +++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt @@ -1,6 +1,5 @@ ^CMake Error at MATH-InvalidExpression.cmake:1 \(math\): - *math cannot parse the expression: "INVALID": syntax error, unexpected - *character, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER - *\(1\). + math cannot parse the expression: "INVALID": syntax error, unexpected \$end, + expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\). Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt new file mode 100644 index 0000000..732ce6f --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\): + Unexpected character in expression at position 1: ' + + Unexpected character in expression at position 7: ' + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake new file mode 100644 index 0000000..d1be218 --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake @@ -0,0 +1,4 @@ +math(EXPR var "'2*1-1'") +if(NOT var EQUAL 1) + message(FATAL_ERROR "Expression did not evaluate to 1") +endif() diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake index 494b813..a4d5c31 100644 --- a/Tests/RunCMake/math/RunCMakeTest.cmake +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -5,4 +5,5 @@ run_cmake(MATH-WrongArgument) run_cmake(MATH-DoubleOption) run_cmake(MATH-TooManyArguments) run_cmake(MATH-InvalidExpression) +run_cmake(MATH-ToleratedExpression) run_cmake(MATH-DivideByZero) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd5c54600b6f651898925bfd9ec4406ccfc7be95 commit dd5c54600b6f651898925bfd9ec4406ccfc7be95 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jul 16 13:04:06 2018 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 13:04:06 2018 -0400 cmExprParserHelper: Simplify error state tracking Errors always have explanation strings, so use the presence of such a string to track whether an error has occurred. This avoids an extra variable. diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index 1f38d33..821667b 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -39,10 +39,9 @@ int cmExprParserHelper::ParseString(const char* str, int verb) yyscan_t yyscanner; cmExpr_yylex_init(&yyscanner); cmExpr_yyset_extra(this, yyscanner); - int res; try { - res = cmExpr_yyparse(yyscanner); + int res = cmExpr_yyparse(yyscanner); if (res != 0) { std::string e = "cannot parse the expression: \"" + InputBuffer + "\": "; e += ErrorString; @@ -55,19 +54,16 @@ int cmExprParserHelper::ParseString(const char* str, int verb) e += fail.what(); e += "."; this->SetError(std::move(e)); - res = 1; } catch (std::out_of_range const&) { std::string e = "cannot evaluate the expression: \"" + InputBuffer + "\": a numeric value is out of range."; this->SetError(std::move(e)); - res = 1; } catch (...) { std::string e = "cannot parse the expression: \"" + InputBuffer + "\"."; this->SetError(std::move(e)); - res = 1; } cmExpr_yylex_destroy(yyscanner); - if (res != 0) { + if (!this->ErrorString.empty()) { return 0; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=185bcface43d95b062c5be16321ae9aa59ed0057 commit 185bcface43d95b062c5be16321ae9aa59ed0057 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jul 16 11:12:34 2018 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 11:12:34 2018 -0400 cmExprParserHelper: Remove some unused code diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index d90d8b9..1f38d33 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -20,7 +20,6 @@ cmExprParserHelper::cmExprParserHelper() cmExprParserHelper::~cmExprParserHelper() { - this->CleanupParser(); } int cmExprParserHelper::ParseString(const char* str, int verb) @@ -69,13 +68,9 @@ int cmExprParserHelper::ParseString(const char* str, int verb) } cmExpr_yylex_destroy(yyscanner); if (res != 0) { - // str << "CAL_Parser returned: " << res << std::endl; - // std::cerr << "When parsing: [" << str << "]" << std::endl; return 0; } - this->CleanupParser(); - if (Verbose) { std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]" << std::endl; @@ -83,10 +78,6 @@ int cmExprParserHelper::ParseString(const char* str, int verb) return 1; } -void cmExprParserHelper::CleanupParser() -{ -} - int cmExprParserHelper::LexInput(char* buf, int maxlen) { // std::cout << "JPLexInput "; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index d4d95b4..15e8f3e 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -41,7 +41,6 @@ private: void Print(const char* place, const char* str); - void CleanupParser(); void SetError(std::string errorString); KWIML_INT_int64_t Result; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71d99e156badae2e12eca56b2b2fa4059cf67cf9 commit 71d99e156badae2e12eca56b2b2fa4059cf67cf9 Author: André Apitzsch <andre.apitz...@etit.tu-chemnitz.de> AuthorDate: Fri Jul 13 13:08:33 2018 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 08:59:36 2018 -0400 Protobuf: restore previous output directory The protobuf upstream implementation has a different default output directory. Restore our original output directory for compatibility. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index b02bc20..d6d1ec6 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -210,7 +210,7 @@ function(protobuf_generate) set(_generated_srcs) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) - list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_basename}${_ext}") endforeach() if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp) @@ -223,7 +223,7 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 commit 2ae2d0bd3e01e6f8f02281d00a1df87f209fa6b5 Author: André Apitzsch <andre.apitz...@etit.tu-chemnitz.de> AuthorDate: Fri Jul 13 13:04:19 2018 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 08:59:33 2018 -0400 Protobuf: restore 'DESCRIPTORS' support This was not present in the upstream code. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index fdd7d48..b02bc20 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -122,7 +122,7 @@ function(protobuf_generate) include(CMakeParseArguments) - set(_options APPEND_PATH) + set(_options APPEND_PATH DESCRIPTORS) set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) if(COMMAND target_sources) list(APPEND _singleargs TARGET) @@ -212,12 +212,18 @@ function(protobuf_generate) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") endforeach() + + if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc") + set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}") + list(APPEND _generated_srcs ${_descriptor_file}) + endif() list(APPEND _generated_srcs_all ${_generated_srcs}) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_protobuf_include_path} ${_abs_file} + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) @@ -233,7 +239,7 @@ function(protobuf_generate) endfunction() function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") if(NOT _proto_files) @@ -245,6 +251,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_append_arg APPEND_PATH) endif() + if(protobuf_generate_cpp_DESCRIPTORS) + set(_descriptors DESCRIPTORS) + endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") endif() @@ -254,19 +264,28 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) endif() set(_outvar) - protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + protobuf_generate(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) set(${SRCS}) set(${HDRS}) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS}) + endif() + foreach(_file ${_outvar}) if(_file MATCHES "cc$") list(APPEND ${SRCS} ${_file}) + elseif(_file MATCHES "desc$") + list(APPEND ${protobuf_generate_cpp_DESCRIPTORS} ${_file}) else() list(APPEND ${HDRS} ${_file}) endif() endforeach() set(${SRCS} ${${SRCS}} PARENT_SCOPE) set(${HDRS} ${${HDRS}} PARENT_SCOPE) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS} "${${protobuf_generate_cpp_DESCRIPTORS}}" PARENT_SCOPE) + endif() endfunction() function(PROTOBUF_GENERATE_PYTHON SRCS) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1385b4b1138eeebd79b6dab940915b509a82cb5f commit 1385b4b1138eeebd79b6dab940915b509a82cb5f Author: André Apitzsch <andre.apitz...@etit.tu-chemnitz.de> AuthorDate: Thu Jul 12 14:27:04 2018 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 08:59:21 2018 -0400 Protobuf: restore 'PROTOBUF_IMPORT_DIRS' check This was not present in the upstream code. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 720e553..fdd7d48 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -245,6 +245,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_append_arg APPEND_PATH) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() @@ -275,6 +279,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) set(_append_arg APPEND_PATH) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bcc0f3678daea6bb7f999ebded1eab471b32e28 commit 1bcc0f3678daea6bb7f999ebded1eab471b32e28 Author: André Apitzsch <andre.apitz...@etit.tu-chemnitz.de> AuthorDate: Thu Jul 12 14:24:48 2018 +0200 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 08:57:08 2018 -0400 Protobuf: use upstream implementation to generate cpp and python files Generate functions are taken from [1] and [2]. The license [3] is already covered by our BSD-3 license for CMake and our inclusion of "Google Inc" in `Copyright.txt`. [1] https://github.com/google/protobuf/blob/93f6b67e/cmake/protobuf-config.cmake.in [2] https://github.com/google/protobuf/blob/93f6b67e/cmake/protobuf-module.cmake.in [3] https://github.com/google/protobuf/blob/93f6b67e/LICENSE diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index e1a715e..720e553 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -119,152 +119,169 @@ # ``ARGN`` # ``.proto`` filess -function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) +function(protobuf_generate) + include(CMakeParseArguments) - set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") - if(NOT PROTO_FILES) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") + set(_options APPEND_PATH) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + + cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") + + if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") return() endif() - if(protobuf_EXPORT_MACRO) - set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:") + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() endif() - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + if(NOT protobuf_generate_PROTOC_OUT_DIR) + set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() - if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + endif() + + if(NOT protobuf_generate_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) endif() endforeach() endif() - set(${SRCS}) - set(${HDRS}) - if (protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS}) + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() endif() - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_path ${_abs_file} PATH) + list(FIND _protobuf_include_path ${_abs_path} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_path}) endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) endif() + endforeach() - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - list(APPEND ${SRCS} "${_protobuf_protoc_src}") - list(APPEND ${HDRS} "${_protobuf_protoc_hdr}") + set(_generated_srcs_all) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + get_filename_component(_basename ${_proto} NAME_WE) + file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir}) - if(protobuf_DESCRIPTORS) - set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc") - set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}") - list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}") - else() - set(_protobuf_protoc_desc "") - set(_protobuf_protoc_flags "") - endif() + set(_generated_srcs) + foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") + endforeach() + list(APPEND _generated_srcs_all ${_generated_srcs}) add_custom_command( - OUTPUT "${_protobuf_protoc_src}" - "${_protobuf_protoc_hdr}" - ${_protobuf_protoc_desc} + OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" - ${_protobuf_protoc_flags} - ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running C++ protocol buffer compiler on ${FIL}" + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${_abs_file} protobuf::protoc + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) endforeach() - set(${SRCS} "${${SRCS}}" PARENT_SCOPE) - set(${HDRS} "${${HDRS}}" PARENT_SCOPE) - if(protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE) + set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) endif() endfunction() -function(PROTOBUF_GENERATE_PYTHON SRCS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") +function(PROTOBUF_GENERATE_CPP SRCS HDRS) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) + + set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") + if(NOT _proto_files) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") return() endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + set(_append_arg APPEND_PATH) endif() if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + set(${SRCS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") - endif() + set(${HDRS}) + foreach(_file ${_outvar}) + if(_file MATCHES "cc$") + list(APPEND ${SRCS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) endif() - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" - COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running Python protocol buffer compiler on ${FIL}" - VERBATIM ) endforeach() - set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() + +function(PROTOBUF_GENERATE_PYTHON SRCS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(_append_arg APPEND_PATH) + endif() + + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) + endif() + + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS} ${_outvar} PARENT_SCOPE) endfunction() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dee7bafb13c654a2d62196451f013ef40dd2120f commit dee7bafb13c654a2d62196451f013ef40dd2120f Author: Anton Myagkov <ant...@transas.com> AuthorDate: Mon Jul 16 11:37:05 2018 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jul 16 08:27:08 2018 -0400 FindOpenCL: Search per-architecture path suffixes on UNIX Use different path suffixes to find opencl for x86 and x86_64. We already do this on Windows. diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 297a5fb..fe162b4 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -119,16 +119,27 @@ if(WIN32) OpenCL/common/lib/x64) endif() else() - find_library(OpenCL_LIBRARY - NAMES OpenCL - PATHS - ENV AMDAPPSDKROOT - ENV CUDA_PATH - PATH_SUFFIXES - lib/x86_64 - lib/x64 - lib - lib64) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86 + lib) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86_64 + lib/x64 + lib + lib64) + endif() endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f431789a9b7dfcd3e350d08fb71521999d2be5c commit 5f431789a9b7dfcd3e350d08fb71521999d2be5c Author: Devin Nakamura <dev...@ca.ibm.com> AuthorDate: Fri Jul 13 13:55:39 2018 -0400 Commit: Devin Nakamura <dev...@ca.ibm.com> CommitDate: Fri Jul 13 13:55:39 2018 -0400 Use isxdigit() to determine if a character is a hex digit Replace custom cm_IsHexChar with isxdigit from the stdlib diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 8deb8c1..4e29f39 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmHexFileConverter.h" +#include <ctype.h> #include <stdio.h> #include <string.h> @@ -12,13 +13,6 @@ #define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2) #define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2) -// might go to SystemTools ? -static bool cm_IsHexChar(char c) -{ - return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))); -} - static unsigned int ChompStrlen(const char* line) { if (line == nullptr) { @@ -169,7 +163,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( } for (unsigned int i = 1; i < slen; i++) { - if (!cm_IsHexChar(buf[i])) { + if (!isxdigit(buf[i])) { return Binary; } } ----------------------------------------------------------------------- Summary of changes: Modules/FindOpenCL.cmake | 31 ++- Modules/FindProtobuf.cmake | 242 ++++++++++++--------- Source/LexerParser/cmExprLexer.cxx | 2 +- Source/LexerParser/cmExprLexer.in.l | 2 +- Source/LexerParser/cmExprParser.cxx | 131 ++++++----- Source/LexerParser/cmExprParser.y | 1 - Source/LexerParser/cmExprParserTokens.h | 4 +- Source/cmExprParserHelper.cxx | 26 +-- Source/cmExprParserHelper.h | 6 +- Source/cmHexFileConverter.cxx | 10 +- Source/cmMathCommand.cxx | 6 + .../math/MATH-InvalidExpression-stderr.txt | 5 +- .../math/MATH-ToleratedExpression-stderr.txt | 8 + Tests/RunCMake/math/MATH-ToleratedExpression.cmake | 4 + Tests/RunCMake/math/RunCMakeTest.cmake | 1 + 15 files changed, 270 insertions(+), 209 deletions(-) create mode 100644 Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt create mode 100644 Tests/RunCMake/math/MATH-ToleratedExpression.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits