Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled clang compiler support #8

Closed
wants to merge 0 commits into from

Conversation

VladimirTakeda
Copy link
Collaborator

No description provided.

# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 3. <Linux, Debug, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, clang-15, default generator>
# 3. <Linux, Debug, clang-15, default generator>
#
Copy link
Collaborator Author

@VladimirTakeda VladimirTakeda Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have't noticed the numbers, so I have to fix here)

@@ -20,7 +20,7 @@ const span<const char>& AbstractBinaryLexeme::Replace(size_t at, size_t alength,

unique_ptr<AbstractBinaryLexeme> AbstractBinaryLexeme::LexemeFromVector(vector<char>&& asrcVec)
{
return unique_ptr<AbstractBinaryLexeme>(new AbstractBinaryLexeme(move(asrcVec)));
return unique_ptr<AbstractBinaryLexeme>(new AbstractBinaryLexeme(std::move(asrcVec)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check Line 7 in this file:
this change is unnecessary

.gitignore Outdated
@@ -6,6 +6,8 @@ buildWinRelease/
build/
.vscode/
x64/
.idea/
cmake-build-debug/
Copy link
Owner

@zproksi zproksi Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason of the "cmake-build-debug/" folder?

Take a look on the script rebuild.sh in the root of the project. run it on your mac - whether it will work?

(It is possible that this folder need to have another name.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use CLion ide and it contains this folders. So, it's just for simplify committing for me.

@@ -51,7 +51,7 @@ unique_ptr<AbstractBinaryLexeme> AbstractBinaryLexeme::LexemeFromLexeme(unique_p


AbstractBinaryLexeme::AbstractBinaryLexeme(vector<char>&& asrcVec)
: dataSequence_(move(asrcVec))
: dataSequence_(std::move(asrcVec))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check Line 7 in this file:
this change is unnecessary
NOTE: why vector at line 53 is not with namespace

#include <ranges>
#include <algorithm>
#include <cstring>

Copy link
Owner

@zproksi zproksi Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include "stdafx.h" from line 1
already contains these includes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't work for clang. I will send you proofs.

@@ -1,6 +1,9 @@
#include "stdafx.h"
#include "fileprocessing.h"

#include <ranges>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include "stdafx.h" from line 1
already contains these includes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't work for clang. I will send you proofs.

@@ -24,11 +27,15 @@ using namespace std::filesystem;

FileProcessing::FileProcessing(const char* fname, const char* mode)
{
#pragma warning(disable: 4996) // I would like to use fopen instead of fopen_s, because
#if !defined(__linux__) && !(defined(__APPLE__) && defined(__MACH__))
#pragma warning(disable: 4996) // I would like to use fopen instead of fopen_s, because
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any precompile directives must be written from 1-st position (no indentation)

if (stream_ = fopen(fname, mode); nullptr == stream_)
#pragma warning(default: 4996)
#if !defined(__linux__) && !(defined(__APPLE__) && defined(__MACH__))
#pragma warning(default: 4996)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any precompile directives must be written from 1-st position (no indentation)

@@ -46,7 +46,7 @@ unique_ptr<ActionsCollection> CreateActionsFile(string_view actionsFileName)

// Parsing of todo and lexemes
// Dictionary will be inside
return unique_ptr<ActionsCollection>(new ActionsCollection(move(adata)));
return unique_ptr<ActionsCollection>(new ActionsCollection(std::move(adata)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hardly believe that we need to use std::move near the usage of unique_ptr without std::

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will double check this moment

@@ -2,6 +2,17 @@ cmake_minimum_required(VERSION 3.19)
set(pname bpatch)
project(test${pname})

include(FetchContent)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was in the version because it is tagged and must work without possibility of harmful code injections
note: GIT_TAG below

##get google test
include(FetchContent)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-1.12.1)
FetchContent_GetProperties(googletest)
#googletest_POPULATED
#googletest_SOURCE_DIR
#googletest_BUILD_DIR
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BUILD_DIR})
endif()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the code from official repo https://github.com/google/googletest/blob/main/googletest/README.md, so it's correct as well.

And I had some troubles with the existing code in clang. For some reason static libraries have been created in wrong directory so the cmake of testbpatch unable to find it.

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one new line between sections in CMakeLists.txt.
PS. remove line 20 below to follow this rule, please

@@ -1,4 +1,5 @@
#include <filesystem>
#include <sstream>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason of this include is unclear.
justify or remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got compilation error using clang. It doesn't see sstream functions

- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет понимания почему тут поменялась 3 на 4.
расскажешь?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure/docker-login#63

Просто вышла новая версия, а на эту кидает ворнинг, что она устарела.

- uses: actions/checkout@v4

- name: Install clang
if: matrix.os=='ubuntu-latest' && matrix.c_compiler=='clang-15'
Copy link
Owner

@zproksi zproksi Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет строк(и) комментария с описанием что происходит и почему это нужно

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants