Skip to content

Commit

Permalink
clang-format: Use InsertNewlineAtEOF and include hpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed Sep 16, 2024
1 parent 948f705 commit 789c3db
Show file tree
Hide file tree
Showing 27 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
Expand Down
2 changes: 1 addition & 1 deletion .github/format-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -ex

if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
for f in $(git diff --diff-filter=AM --name-only origin/$GITHUB_BASE_REF 'vita3k/**.cpp' 'vita3k/**.h' 'tools/**.cpp' 'tools/**.h'); do
for f in $(git diff --diff-filter=AM --name-only origin/$GITHUB_BASE_REF 'vita3k/**.cpp' 'vita3k/**.h' 'vita3k/**.hpp' 'tools/**.cpp' 'tools/**.h' 'tools/**.hpp'); do
if [ "$(diff -u <(cat $f) <(clang-format $f))" != "" ]
then
echo "run format"
Expand Down
4 changes: 2 additions & 2 deletions format.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off
cd vita3k
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h *.hpp /b/s') do clang-format -i %%f
cd ..\tools
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h *.hpp /b/s') do clang-format -i %%f
cd ..
2 changes: 1 addition & 1 deletion format.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -ex

find vita3k tools/gen-modules tools/native-tool \( -name *.cpp -o -name *.h \) | xargs clang-format -i
find vita3k tools/gen-modules tools/native-tool \( -name *.cpp -o -name *.h -o -name *.hpp \) | xargs clang-format -i
2 changes: 1 addition & 1 deletion vita3k/glutil/include/glutil/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
#pragma once

#include <glad/gl.h>
#undef APIENTRY
#undef APIENTRY
2 changes: 1 addition & 1 deletion vita3k/gxm/src/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ uint32_t attribute_format_size(SceGxmAttributeFormat format) {
uint32_t index_element_size(SceGxmIndexFormat format) {
return (format == SCE_GXM_INDEX_FORMAT_U16) ? 2 : 4;
}
} // namespace gxm
} // namespace gxm
2 changes: 1 addition & 1 deletion vita3k/kernel/include/kernel/object_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ class ObjectStore {
private:
std::mutex mutex;
std::map<uint32_t, std::shared_ptr<void>> objs;
};
};
2 changes: 1 addition & 1 deletion vita3k/mem/include/mem/mempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ struct MempoolObject {
bool free(const Ptr<T> ptr) {
return free_raw(ptr.template cast<void>());
}
};
};
2 changes: 1 addition & 1 deletion vita3k/module/src/read_arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
template <>
module::vargs make_vargs(const LayoutArgsState &state) {
return module::vargs{ state };
}
}
2 changes: 1 addition & 1 deletion vita3k/ngs/include/ngs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ enum class BussType : uint32_t {
};

static constexpr std::uint32_t MAX_OUTPUT_PORT = 4;
} // namespace ngs
} // namespace ngs
2 changes: 1 addition & 1 deletion vita3k/ngs/include/ngs/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ struct State {
};

bool init(State &ngs, MemState &mem);
} // namespace ngs
} // namespace ngs
2 changes: 1 addition & 1 deletion vita3k/ngs/src/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bool deliver_data(const MemState &mem, const std::vector<Voice *> &voice_queue,

return true;
}
} // namespace ngs
} // namespace ngs
2 changes: 1 addition & 1 deletion vita3k/renderer/include/renderer/shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ std::vector<uint32_t> load_spirv_shader(const SceGxmProgram &program, const Feat
std::string pre_load_shader_glsl(const fs::path &shader_path);
std::vector<uint32_t> pre_load_shader_spirv(const fs::path &shader_path);

} // namespace renderer
} // namespace renderer
2 changes: 1 addition & 1 deletion vita3k/renderer/src/vulkan/creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,4 @@ bool create(std::unique_ptr<FragmentProgram> &fp, VKState &state, const SceGxmPr
return true;
}

} // namespace renderer::vulkan
} // namespace renderer::vulkan
2 changes: 1 addition & 1 deletion vita3k/renderer/src/vulkan/screen_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,4 @@ void ScreenRenderer::create_surface_image() {
std::tie(vita_surface_staging, vita_surface_staging_alloc) = state.allocator.createBuffer(buffer_info, vkutil::vma_mapped_alloc, vita_surface_staging_info);
}

} // namespace renderer::vulkan
} // namespace renderer::vulkan
2 changes: 1 addition & 1 deletion vita3k/renderer/src/vulkan/sync_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,4 @@ void refresh_pipeline(VKContext &context) {
context.refresh_pipeline = true;
}

} // namespace renderer::vulkan
} // namespace renderer::vulkan
2 changes: 1 addition & 1 deletion vita3k/shader/include/shader/gxp_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ usse::ProgramInput get_program_input(const SceGxmProgram &program);
usse::DataType get_texture_component_type(SceGxmTextureFormat format);
uint8_t get_texture_component_count(SceGxmTextureFormat format);

} // namespace shader
} // namespace shader
2 changes: 1 addition & 1 deletion vita3k/shader/include/shader/types_imm.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ using Imm62 = uint64_t;
using Imm63 = uint64_t;
using Imm64 = uint64_t;

} // namespace shader::usse
} // namespace shader::usse
2 changes: 1 addition & 1 deletion vita3k/shader/include/shader/usse_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ void make_for_loop(spv::Builder &b, spv::Id iterator, spv::Id initial_value_ite,
b.setBuildPoint(&blocks.merge);
b.closeLoop();
}
} // namespace shader::usse::utils
} // namespace shader::usse::utils
2 changes: 1 addition & 1 deletion vita3k/shader/src/gxp_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,4 @@ uint8_t get_texture_component_count(SceGxmTextureFormat format) {
}
}

} // namespace shader
} // namespace shader
2 changes: 1 addition & 1 deletion vita3k/shader/src/translator/illegal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ bool shader::usse::USSETranslatorVisitor::illegal24() {
bool shader::usse::USSETranslatorVisitor::illegal27() {
LOG_ERROR("Illegal shader opcode: 27");
return false;
}
}
2 changes: 1 addition & 1 deletion vita3k/shader/src/translator/special.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ bool USSETranslatorVisitor::kill(
m_b.makeStatementTerminator(spv::OpKill, "kill");

return true;
}
}
2 changes: 1 addition & 1 deletion vita3k/util/include/util/arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@

uint32_t encode_arm_inst(uint8_t type, uint32_t immed, uint16_t reg);
// SVC not implemented for thumb
uint32_t encode_thumb_inst(uint8_t type, uint32_t immed, uint16_t reg);
uint32_t encode_thumb_inst(uint8_t type, uint32_t immed, uint16_t reg);
2 changes: 1 addition & 1 deletion vita3k/util/include/util/float_to_half.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ auto encode_flt16(F &&value) { return flt16_encoder::encode<true>(std::forward<F

template <typename F = float, typename X>
auto decode_flt16(X &&value) { return flt16_encoder::decode<F>(std::forward<X>(value)); }
} // namespace util
} // namespace util
2 changes: 1 addition & 1 deletion vita3k/util/include/util/keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

#if defined(_MSC_VER)
#define __restrict__ __restrict
#endif
#endif
2 changes: 1 addition & 1 deletion vita3k/vkutil/include/vkutil/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ class DestroyQueue {
void destroy_objects();
};

} // namespace vkutil
} // namespace vkutil
2 changes: 1 addition & 1 deletion vita3k/vkutil/src/vkutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ vk::ComponentMapping color_to_texture_swizzle(const vk::ComponentMapping &swizzl
return result_comp;
}

} // namespace vkutil
} // namespace vkutil

0 comments on commit 789c3db

Please sign in to comment.