Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/output
/build
/lib
/.vs/
/.vscode/
/.idea/
*.d
*.a
*.o
Expand Down
2 changes: 1 addition & 1 deletion libhydrosphere/CPPLINT.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

set noparent

filter=-runtime/references
filter=-runtime/references,-runtime/int,-build/include_what_you_use
exclude_files=external|build
Empty file modified libhydrosphere/fix_codestyle
100644 → 100755
Empty file.
33 changes: 20 additions & 13 deletions libhydrosphere/include/hs/diag/diag_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,38 @@ namespace hs::diag {

/**
* \short Causes abnormal process termination.
*
* This send abort information to an availaible logger (currently only hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for better debugging capabilities.
*
* This send abort information to an availaible logger (currently only
* hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for
* better debugging capabilities.
*/
void Abort(const char *failed_condition, const char *file_name,
const char *function_name, int line_number) noexcept;

/**
* \short Causes abnormal process termination with a custom message.
*
* This send abort information to an availaible logger (currently only hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for better debugging capabilities.
*
* This send abort information to an availaible logger (currently only
* hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for
* better debugging capabilities.
*/
void Abort(const char *failed_condition, const char *file_name,
const char *function_name, int line_number, const char *format,
...) noexcept;

/**
* \short Causes abnormal process termination with a hs::Result and a custom message.
*
* This send abort information to an availaible logger (currently only hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for better debugging capabilities.
* \short Causes abnormal process termination with a hs::Result and a custom
* message.
*
* This send abort information to an availaible logger (currently only
* hs::svc::OutputDebugString) before calling hs::svc::Break.
*
* \remark In the future, this will propagate the abort to an observer for
* better debugging capabilities.
*/
void Abort(const char *failed_condition, const char *file_name,
const char *function_name, int line_number, const hs::Result *result,
Expand Down
31 changes: 16 additions & 15 deletions libhydrosphere/include/hs/diag/diag_macro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,37 @@

/**
* \def __HS_ABORT_CONDITIONAL(condition, ...)
* \short Calls hs::diag::Abort with a given formatable message if the condition evaluates to false.
* \remark The formatable message is striped out in release builds.
*/
* \short Calls hs::diag::Abort with a given formatable message if the condition
* evaluates to false. \remark The formatable message is striped out in release
* builds.
*/

/**
* \def __HS_DEBUG_ASSERT(condition)
* \short Calls hs::diag::Abort if the condition evaluates to false in debug builds.
*/
* \short Calls hs::diag::Abort if the condition evaluates to false in debug
* builds.
*/

/**
* \def __HS_ABORT()
* \short Unconditionally calls hs::diag::Abort.
*/
*/

/**
* \def __HS_ASSERT(condition)
* \short Calls hs::diag::Abort if the condition evaluates to false.
*/
*/

/**
* \def __HS_ABORT_UNLESS_NOT_NULL(ptr)
* \short Calls hs::diag::Abort if the given ptr is null.
*/
*/

/**
* \def __HS_ABORT_CONDITIONAL_RESULT(condition, result)
* \short Calls hs::diag::Abort with a given result if the condition evaluates to false.
*/
* \short Calls hs::diag::Abort with a given result if the condition evaluates
* to false.
*/

#ifdef HYDROSPHERE_DEBUG_DIAG
#define __HS_ABORT_CONDITIONAL(condition, ...) \
Expand All @@ -65,14 +68,12 @@
#define __HS_DEBUG_ASSERT(condition, ...)
#endif

#define __HS_ABORT() \
__HS_ABORT_CONDITIONAL(false, "Unknown Hydrosphere abort")
#define __HS_ABORT() __HS_ABORT_CONDITIONAL(false, "Unknown Hydrosphere abort")
#define __HS_ASSERT(condition) \
__HS_ABORT_CONDITIONAL(condition, "Assertion failed")
#define __HS_ABORT_UNLESS_NOT_NULL(ptr) \
__HS_ASSERT(ptr != nullptr)
#define __HS_ABORT_UNLESS_NOT_NULL(ptr) __HS_ASSERT(ptr != nullptr)

#define __HS_ABORT_CONDITIONAL_RESULT(condition, result) \
#define __HS_ABORT_CONDITIONAL_RESULT(condition, result) \
__HS_ABORT_CONDITIONAL(condition, &result, "Assertion failed")

/**
Expand Down
2 changes: 2 additions & 0 deletions libhydrosphere/include/hs/hs_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
#ifdef __aarch64__
#define HYDROSPHERE_TARGET_ARCH_NAME aarch64
#define HYDROSPHERE_TARGET_AARCH64 1
#define __HS_CPU_PTR_ALIGN 0x10
#elif __arm__
#define HYDROSPHERE_TARGET_ARCH_NAME aarch32
#define HYDROSPHERE_TARGET_AARCH32 1
#define __HS_CPU_PTR_ALIGN 0x4
#else
#error "Cannot determine the target architecture!"
#endif
Expand Down
4 changes: 2 additions & 2 deletions libhydrosphere/include/hs/hs_macro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define __HS_ATTRIBUTE_ALIGNED(align) __attribute__((aligned(align)))
#define __HS_ASM __asm__

#define __HS_DISALLOW_COPY(TypeName) \
/** \private */ \
#define __HS_DISALLOW_COPY(TypeName) \
/** \private */ \
TypeName(const TypeName&) = delete
#define __HS_DISALLOW_ASSIGN(TypeName) \
/** \private */ \
Expand Down
9 changes: 5 additions & 4 deletions libhydrosphere/include/hs/hs_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Result {

public:
/**
* \short Construct a Result from a raw value.
* \param[in] value The raw result value that defines the new Result.
*/
* \short Construct a Result from a raw value.
* \param[in] value The raw result value that defines the new Result.
*/
explicit Result(uint32_t value) noexcept : value(value) {}

/**
Expand All @@ -35,7 +35,8 @@ class Result {
inline bool Ok() const noexcept { return value == Success; }

/**
* \short Check if the raw result code value doesn't match the Result::Success value
* \short Check if the raw result code value doesn't match the
* Result::Success value
*/
inline bool Err() const noexcept { return !Ok(); }

Expand Down
17 changes: 17 additions & 0 deletions libhydrosphere/include/hs/mem.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2019 Hydrosphère Developers
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
* option. This file may not be copied, modified, or distributed
* except according to those terms.
*/

#pragma once

#include <hs/mem/memory_allocator.hpp>
#include <hs/mem/memory_default_delete.hpp>
#include <hs/mem/memory_api.hpp>
#include <hs/mem/unique_ptr.hpp>
#include <hs/mem/shared_ptr.hpp>
Loading