From 687d879c7a356945f46db6e1ca39afa82fbeda08 Mon Sep 17 00:00:00 2001 From: realstealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Sun, 29 Nov 2026 23:32:46 +0000 Subject: [PATCH] chore: make clang-tidy use cxx17 for linting (#3295) * chore: make sorting directory use c++17 * chore: make clang-tidy use standard present in compile commands --- scripts/file_linter.py | 2 +- sorting/CMakeLists.txt | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) mode change 100644 => 100755 scripts/file_linter.py diff --git a/scripts/file_linter.py b/scripts/file_linter.py old mode 100644 new mode 100755 index f26fbfea0..21b639071 --- a/scripts/file_linter.py +++ b/scripts/file_linter.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import os import subprocess import sys @@ -31,7 +32,6 @@ with open("git_diff.txt") as in_file: "clang-tidy", "--fix", "-p=build", - "--extra-arg=-std=c++11", *cpp_files, "--", ], diff --git a/sorting/CMakeLists.txt b/sorting/CMakeLists.txt index 00877bb61..78fd7dd4d 100644 --- a/sorting/CMakeLists.txt +++ b/sorting/CMakeLists.txt @@ -1,20 +1,17 @@ # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. -file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) +file(GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) # file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) # AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES) -foreach( testsourcefile ${APP_SOURCES} ) - # I used a simple string replace, to cut off .cpp. - string( REPLACE ".cpp" "" testname ${testsourcefile} ) - add_executable( ${testname} ${testsourcefile} ) +foreach(testsourcefile ${APP_SOURCES}) + # I used a simple string replace, to cut off .cpp. + string(REPLACE ".cpp" "" testname ${testsourcefile}) + add_executable(${testname} ${testsourcefile}) - set_target_properties(${testname} PROPERTIES - LINKER_LANGUAGE CXX - CXX_STANDARD 14) - if(OpenMP_CXX_FOUND) - target_link_libraries(${testname} OpenMP::OpenMP_CXX) - endif() - install(TARGETS ${testname} DESTINATION "bin/sorting") + if(OpenMP_CXX_FOUND) + target_link_libraries(${testname} OpenMP::OpenMP_CXX) + endif() + install(TARGETS ${testname} DESTINATION "bin/sorting") -endforeach( testsourcefile ${APP_SOURCES} ) +endforeach()