Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cvise for openSUSE:Factory checked in at 2021-12-21 18:40:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cvise (Old) and /work/SRC/openSUSE:Factory/.cvise.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cvise" Tue Dec 21 18:40:58 2021 rev:44 rq:941895 version:2.4.0+git.20211209.2669efd Changes: -------- --- /work/SRC/openSUSE:Factory/cvise/cvise.changes 2021-11-27 00:52:26.522570526 +0100 +++ /work/SRC/openSUSE:Factory/.cvise.new.2520/cvise.changes 2021-12-21 18:41:42.893932181 +0100 @@ -1,0 +2,13 @@ +Tue Dec 21 16:43:18 UTC 2021 - mli...@suse.cz + +- Update to version 2.4.0+git.20211209.2669efd: + * Fix file handling in lines pass. + * Allow and document building on windows + * Remove tests. + * handle user-defined literals for remove-namespace pass + * skip CallExpr if CurrentStmt is null + * Fix README + * Fix formatting. + * Improve wording related to compiler warnings. + +------------------------------------------------------------------- Old: ---- cvise-2.4.0+git.20211126.bd7809f.tar.xz New: ---- cvise-2.4.0+git.20211209.2669efd.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cvise.spec ++++++ --- /var/tmp/diff_new_pack.hPYXfD/_old 2021-12-21 18:41:43.293932540 +0100 +++ /var/tmp/diff_new_pack.hPYXfD/_new 2021-12-21 18:41:43.297932544 +0100 @@ -17,7 +17,7 @@ Name: cvise -Version: 2.4.0+git.20211126.bd7809f +Version: 2.4.0+git.20211209.2669efd Release: 0 Summary: Super-parallel Python port of the C-Reduce License: BSD-3-Clause ++++++ cvise-2.4.0+git.20211126.bd7809f.tar.xz -> cvise-2.4.0+git.20211209.2669efd.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/INSTALL.md new/cvise-2.4.0+git.20211209.2669efd/INSTALL.md --- old/cvise-2.4.0+git.20211126.bd7809f/INSTALL.md 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/INSTALL.md 2021-12-09 10:54:58.000000000 +0100 @@ -140,6 +140,31 @@ cmake ... -DENABLE_TRANS_ASSERT=OFF ``` +## Building on windows + +Build LLVM according to https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm +I used these LLVM build options: +``` +@call "%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 +mkdir build +cd build +"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -S ..\llvm -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -Thost=x64 +msbuild ALL_BUILD.vcxproj /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m +``` + +Download flex from https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip + +``` +pip install pytest psutil pebble +@call "%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 +set LLVM_DIR=D:\src\llvm-project\build\lib\cmake\llvm +set CLANG_DIR=D:\src\llvm-project\build\lib\cmake\clang +"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -A x64 -Thost=x64 c:\src\cvise -DCMAKE_INSTALL_PREFIX=c:\tools\cvise\ +msbuild INSTALL.vcxproj /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m +``` + +Run with: `python C:\tools\cvise\bin\cvise` + ## Testing You can test the project with: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/README.md new/cvise-2.4.0+git.20211209.2669efd/README.md --- old/cvise-2.4.0+git.20211126.bd7809f/README.md 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/README.md 2021-12-09 10:54:58.000000000 +0100 @@ -126,3 +126,7 @@ 1. If you copy the compiler invocation line from your build tool, remove -Werror if present. Some C-Vise passes introduce warnings, so -Werror will make those passes ineffective. + + Doing that, a reduction will typically end up faster, however, + one may end up with a code snippet full of warnings that needs + to be addresses after the reduction. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/LiftAssignmentExpr.cpp new/cvise-2.4.0+git.20211209.2669efd/clang_delta/LiftAssignmentExpr.cpp --- old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/LiftAssignmentExpr.cpp 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/clang_delta/LiftAssignmentExpr.cpp 2021-12-09 10:54:58.000000000 +0100 @@ -167,6 +167,9 @@ bool AssignExprStatementVisitor::VisitCallExpr(CallExpr *CallE) { + if (!CurrentStmt) + return false; + for (CallExpr::arg_iterator I = CallE->arg_begin(), E = CallE->arg_end(); I != E; ++I) { Expr *Exp = *I; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/RemoveNamespace.cpp new/cvise-2.4.0+git.20211209.2669efd/clang_delta/RemoveNamespace.cpp --- old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/RemoveNamespace.cpp 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/clang_delta/RemoveNamespace.cpp 2021-12-09 10:54:58.000000000 +0100 @@ -348,12 +348,19 @@ } const ValueDecl *OrigDecl = DRE->getDecl(); + if (isa<FunctionDecl>(OrigDecl) || isa<VarDecl>(OrigDecl) || isa<EnumConstantDecl>(OrigDecl)) { std::string Name; if (ConsumerInstance->getNewName(OrigDecl, Name)) { - ConsumerInstance->TheRewriter.ReplaceText(DRE->getBeginLoc(), - OrigDecl->getNameAsString().size(), Name); + unsigned Len = OrigDecl->getNameAsString().size(); + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(OrigDecl)) { + // handle user-defined literals + if (const IdentifierInfo *IdInfo = FD->getLiteralIdentifier()) { + Len = IdInfo->getLength(); + } + } + ConsumerInstance->TheRewriter.ReplaceText(DRE->getBeginLoc(), Len, Name); } } @@ -934,7 +941,6 @@ return; std::string NewName = NamePrefix + NamespaceName; - const IdentifierInfo *IdInfo = ND->getIdentifier(); NewName += "_"; if ( const TemplateDecl *TD = dyn_cast<TemplateDecl>(ND) ) { @@ -951,8 +957,21 @@ return; } + const IdentifierInfo *IdInfo = ND->getIdentifier(); + bool IsUserLiteral = false; + if (!IdInfo) { + const FunctionDecl *FD = cast<FunctionDecl>(ND); + IdInfo = FD->getLiteralIdentifier(); + if (IdInfo) + IsUserLiteral = true; + } + TransAssert(IdInfo && "Invalid IdentifierInfo!"); NewName += IdInfo->getName(); + // Make sure we have valid suffix for user literals + if (IsUserLiteral && IdInfo->getName().startswith("_")) { + NewName = "_" + NewName; + } NamedDeclToNewName[ND] = NewName; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/RewriteUtils.cpp new/cvise-2.4.0+git.20211209.2669efd/clang_delta/RewriteUtils.cpp --- old/cvise-2.4.0+git.20211126.bd7809f/clang_delta/RewriteUtils.cpp 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/clang_delta/RewriteUtils.cpp 2021-12-09 10:54:58.000000000 +0100 @@ -979,6 +979,25 @@ // applying getNameAsString() on SomeClass() gives us SomeClass<T>. DeclarationNameInfo NameInfo = FD->getNameInfo(); + if (const IdentifierInfo *IdInfo = FD->getLiteralIdentifier()) { + SourceLocation OpLoc = NameInfo.getBeginLoc(); + const char *OpStartBuf = SrcManager->getCharacterData(OpLoc); + + // skip string operator + std::string TmpStr(OpStartBuf, + TheRewriter->getRangeSize(NameInfo.getSourceRange())); + std::string OperatorStr = "operator"; + size_t Pos = TmpStr.find(OperatorStr); + TransAssert(Pos != std::string::npos && "cannot find operator!"); + + size_t OldNamePos = + TmpStr.find(IdInfo->getNameStart(), Pos, IdInfo->getLength()); + TransAssert(OldNamePos != std::string::npos && "cannot find old name!"); + + SourceLocation NewStartLoc = OpLoc.getLocWithOffset(OldNamePos); + return !TheRewriter->ReplaceText(NewStartLoc, IdInfo->getLength(), NameStr); + } + DeclarationName DeclName = NameInfo.getName(); DeclarationName::NameKind K = DeclName.getNameKind(); TransAssert((K != DeclarationName::CXXDestructorName) && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/clex/CMakeLists.txt new/cvise-2.4.0+git.20211209.2669efd/clex/CMakeLists.txt --- old/cvise-2.4.0+git.20211126.bd7809f/clex/CMakeLists.txt 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/clex/CMakeLists.txt 2021-12-09 10:54:58.000000000 +0100 @@ -54,6 +54,10 @@ set_source_files_properties(clex.c PROPERTIES COMPILE_FLAGS -Wno-unused-function) set_source_files_properties(strlex.c PROPERTIES COMPILE_FLAGS -Wno-unused-function) endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") +set_source_files_properties(clex.c PROPERTIES COMPILE_FLAGS -DYY_NO_UNISTD_H) +set_source_files_properties(strlex.c PROPERTIES COMPILE_FLAGS -DYY_NO_UNISTD_H) +endif() ############################################################################### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/clex/driver.c new/cvise-2.4.0+git.20211209.2669efd/clex/driver.c --- old/cvise-2.4.0+git.20211126.bd7809f/clex/driver.c 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/clex/driver.c 2021-12-09 10:54:58.000000000 +0100 @@ -20,6 +20,14 @@ #include "defs.h" +#ifdef _MSC_VER +// MSVC lacks this compiler builtin +__declspec(noreturn) void __builtin_unreachable() +{ + abort(); +} +#endif + struct tok_t { char *str; enum tok_kind kind; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/cvise/passes/lines.py new/cvise-2.4.0+git.20211209.2669efd/cvise/passes/lines.py --- old/cvise-2.4.0+git.20211126.bd7809f/cvise/passes/lines.py 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/cvise/passes/lines.py 2021-12-09 10:54:58.000000000 +0100 @@ -14,7 +14,8 @@ def __format(self, test_case, check_sanity): tmp = os.path.dirname(test_case) - with tempfile.NamedTemporaryFile(mode='w+', delete=False, dir=tmp) as tmp_file: + + with tempfile.NamedTemporaryFile(mode='w+', dir=tmp) as backup, tempfile.NamedTemporaryFile(mode='w+', dir=tmp) as tmp_file: with open(test_case, 'r') as in_file: try: cmd = [self.external_programs['topformflat'], self.arg] @@ -26,21 +27,19 @@ if not line.isspace(): tmp_file.write(line) - # we need to check that sanity check is still fine - if check_sanity: - backup = tempfile.NamedTemporaryFile(mode='w+', delete=False, dir=tmp) - shutil.copyfile(test_case, backup.name) - shutil.move(tmp_file.name, test_case) - try: - check_sanity() - os.unlink(backup.name) - except InsaneTestCaseError: - shutil.move(backup.name, test_case) - # if we are not the first lines pass, we should bail out - if self.arg != '0': - self.bailout = True - else: - shutil.move(tmp_file.name, test_case) + # we need to check that sanity check is still fine + if check_sanity: + shutil.copy(test_case, backup.name) + shutil.copy(tmp_file.name, test_case) + try: + check_sanity() + except InsaneTestCaseError: + shutil.copy(backup.name, test_case) + # if we are not the first lines pass, we should bail out + if self.arg != '0': + self.bailout = True + else: + shutil.copy(tmp_file.name, test_case) def __count_instances(self, test_case): with open(test_case, 'r') as in_file: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.4.0+git.20211126.bd7809f/delta/CMakeLists.txt new/cvise-2.4.0+git.20211209.2669efd/delta/CMakeLists.txt --- old/cvise-2.4.0+git.20211126.bd7809f/delta/CMakeLists.txt 2021-11-26 10:52:24.000000000 +0100 +++ new/cvise-2.4.0+git.20211209.2669efd/delta/CMakeLists.txt 2021-12-09 10:54:58.000000000 +0100 @@ -29,7 +29,13 @@ ${FLEX_topformflat_scanner_OUTPUTS} ) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set_source_files_properties(topformflat.c PROPERTIES COMPILE_FLAGS "-Wno-unused-function -Wno-unused-parameter") +endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") +set_source_files_properties(topformflat.c PROPERTIES COMPILE_FLAGS -DYY_NO_UNISTD_H) +endif() ###############################################################################