Skip to content

Commit

Permalink
Change macro newline alignement.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Oct 5, 2023
1 parent 88a83e3 commit 5d4f0fa
Show file tree
Hide file tree
Showing 38 changed files with 265 additions and 275 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AlignAfterOpenBracket: DontAlign
AlignConsecutiveBitFields: true
# AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
# AlignEscapedNewlines: Right
AlignEscapedNewlines: DontAlign
# AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
Expand Down
11 changes: 5 additions & 6 deletions source/adt/include/adt/adt_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ extern "C" {
/* -- Macros -- */

/* This is a temporary solution for safe strings, it can be improved in the future */
#define string_copy(dest, src, dest_size) \
do \
{ \
#define string_copy(dest, src, dest_size) \
do \
{ \
size_t __string_copy_length = strnlen(src, dest_size - 1); \
memcpy(dest, src, __string_copy_length); \
dest[__string_copy_length] = '\0'; \
\
memcpy(dest, src, __string_copy_length); \
dest[__string_copy_length] = '\0'; \
} while (0)

#ifdef __cplusplus
Expand Down
40 changes: 16 additions & 24 deletions source/adt/include/adt/adt_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,11 @@ typedef struct vector_type *vector;
* @param[in] type_name
* Type of element to be modified
*/
#define vector_set_const(v, position, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
\
#define vector_set_const(v, position, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
vector_set(v, position, &macro_vector_type_const_to_var); \
\
} while (0)

/**
Expand All @@ -228,13 +226,11 @@ typedef struct vector_type *vector;
* @param[in] type_name
* Type of element to be inserted
*/
#define vector_push_back_const(v, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
\
#define vector_push_back_const(v, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
vector_push_back(v, &macro_vector_type_const_to_var); \
\
} while (0)

/**
Expand All @@ -251,13 +247,11 @@ typedef struct vector_type *vector;
* @param[in] type_name
* Type of element to be inserted
*/
#define vector_push_front_const(v, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
\
#define vector_push_front_const(v, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
vector_push_front(v, &macro_vector_type_const_to_var); \
\
} while (0)

/**
Expand All @@ -279,13 +273,11 @@ typedef struct vector_type *vector;
* @param[in] type_name
* Type of element to be inserted
*/
#define vector_insert_const(v, position, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
\
#define vector_insert_const(v, position, constant, type_name) \
do \
{ \
type_name macro_vector_type_const_to_var = constant; \
vector_insert(v, position, &macro_vector_type_const_to_var); \
\
} while (0)

/* -- Methods -- */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <cli_core_plugin/cli_core_plugin.h>

#include <plugin/plugin_interface.h>
#include <plugin/plugin_interface.hpp>

#include <string.h>

Expand Down
12 changes: 6 additions & 6 deletions source/dynlink/include/dynlink/dynlink_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ extern "C" {
*
*/
#define DYNLINK_FLAGS_SET(flags, flag) \
do \
{ \
flags = (flag); \
do \
{ \
flags = (flag); \
} while (0)

/**
Expand All @@ -83,9 +83,9 @@ extern "C" {
*
*/
#define DYNLINK_FLAGS_ADD(flags, flag) \
do \
{ \
flags |= (flag); \
do \
{ \
flags |= (flag); \
} while (0)

/**
Expand Down
4 changes: 2 additions & 2 deletions source/dynlink/include/dynlink/dynlink_impl_symbol_beos.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ extern "C" {

/* -- Macros -- */

#define DYNLINK_SYMBOL_EXPORT(name) \
#define DYNLINK_SYMBOL_EXPORT(name) \
DYNLINK_API struct dynlink_symbol_addr_beos_type DYNLINK_SYMBOL_NAME(name) = { \
(dynlink_symbol_addr_beos_impl)&name \
(dynlink_symbol_addr_beos_impl)&name \
}

#define DYNLINK_SYMBOL_GET(name) \
Expand Down
4 changes: 2 additions & 2 deletions source/dynlink/include/dynlink/dynlink_impl_symbol_macos.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ extern "C" {

/* -- Macros -- */

#define DYNLINK_SYMBOL_EXPORT(name) \
#define DYNLINK_SYMBOL_EXPORT(name) \
DYNLINK_API struct dynlink_symbol_addr_macos_type DYNLINK_SYMBOL_NAME(name) = { \
(dynlink_symbol_addr_macos_impl)&name \
(dynlink_symbol_addr_macos_impl)&name \
}

#define DYNLINK_SYMBOL_GET(name) \
Expand Down
4 changes: 2 additions & 2 deletions source/dynlink/include/dynlink/dynlink_impl_symbol_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ extern "C" {

/* -- Macros -- */

#define DYNLINK_SYMBOL_EXPORT(name) \
#define DYNLINK_SYMBOL_EXPORT(name) \
DYNLINK_API struct dynlink_symbol_addr_unix_type DYNLINK_SYMBOL_NAME(name) = { \
(dynlink_symbol_addr_unix_impl)&name \
(dynlink_symbol_addr_unix_impl)&name \
}

#define DYNLINK_SYMBOL_GET(name) \
Expand Down
6 changes: 3 additions & 3 deletions source/dynlink/include/dynlink/dynlink_impl_symbol_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ extern "C" {
/* -- Macros -- */

#define DYNLINK_SYMBOL_EXPORT(name) \
DYNLINK_NO_EXPORT struct \
{ \
char name; \
DYNLINK_NO_EXPORT struct \
{ \
char name; \
} PREPROCESSOR_CONCAT(dynlink_no_export_, name)

#define DYNLINK_SYMBOL_GET(name) name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ extern "C" {

/* -- Definitions -- */

#if defined(WIN32) || defined(_WIN32) || \
#if defined(WIN32) || defined(_WIN32) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__MINGW32__) || defined(__MINGW64__)
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR_C '\\'
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR "\\"
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) || \
defined(__HAIKU__) || defined(__BEOS__)
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR_C '/'
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR "/"
Expand Down
8 changes: 4 additions & 4 deletions source/environment/source/environment_variable_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

/* -- Definitions -- */

#if defined(WIN32) || defined(_WIN32) || \
#if defined(WIN32) || defined(_WIN32) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__MINGW32__) || defined(__MINGW64__)
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR(chr) (chr == '/' || chr == '\\')
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) || \
defined(__HAIKU__) || defined(__BEOS__)
#define ENVIRONMENT_VARIABLE_PATH_SEPARATOR(chr) (chr == '/')
#else
Expand Down
6 changes: 3 additions & 3 deletions source/format/include/format/format_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ extern "C" {
#ifndef vsnprintf
#define vsnprintf _vsnprintf
#endif
#elif (defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1900)) || \
defined(_BSD_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || \
#elif (defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1900)) || \
defined(_BSD_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || \
defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
defined(__HAIKU__) || defined(__BEOS__) || \
defined(__HAIKU__) || defined(__BEOS__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__)

/* Supported */
Expand Down
48 changes: 24 additions & 24 deletions source/format/include/format/format_specifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ extern "C" {
#include <stddef.h>
#include <stdint.h>

#if !defined(_WIN32) && \
(defined(unix) || defined(__unix__) || defined(__unix) || \
#if !defined(_WIN32) && \
(defined(unix) || defined(__unix__) || defined(__unix) || \
defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__))

#include <unistd.h>
Expand All @@ -59,31 +59,31 @@ extern "C" {

/* -- Definitions -- */

#if defined(__LP64__) || defined(_LP64) || \
defined(_WIN64) || \
#if defined(__LP64__) || defined(_LP64) || \
defined(_WIN64) || \
defined(alpha) || defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) || \
defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64) || \
defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || defined(__amd64) || \
defined(__mips64) || \
defined(__powerpc64__) || defined(__ppc64__) || defined(_ARCH_PPC64) || \
defined(__arch64__) || defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \
defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64) || \
defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || defined(__amd64) || \
defined(__mips64) || \
defined(__powerpc64__) || defined(__ppc64__) || defined(_ARCH_PPC64) || \
defined(__arch64__) || defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \
defined(__s390__) || defined(__s390x__)

#define FORMAT_64BIT 1 /* 64-bit */

#elif defined(_ILP32) || defined(__ILP32__) || \
defined(_WIN32) || \
defined(__386__) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__X86) || defined(_M_IX86) || \
defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000) || \
defined(__hppa) || defined(__hppa__) || \
((defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__powerpc64__) || defined(__PPC__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC)) && \
!defined(__powerpc64__)) || \
(defined(_ARCH_COM) && defined(_ARCH_PPC)) || \
#elif defined(_ILP32) || defined(__ILP32__) || \
defined(_WIN32) || \
defined(__386__) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__X86) || defined(_M_IX86) || \
defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000) || \
defined(__hppa) || defined(__hppa__) || \
((defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__powerpc64__) || defined(__PPC__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC)) && \
!defined(__powerpc64__)) || \
(defined(_ARCH_COM) && defined(_ARCH_PPC)) || \
((defined(__sparc__) || defined(__sparc) || defined(sparc)) && !(defined(__arch64__) || defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__))) || \
defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) || \
defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) || \
defined(nios2) || defined(__nios2) || defined(__nios2__)

#define FORMAT_32BIT 1 /* 32-bit */
Expand All @@ -94,8 +94,8 @@ extern "C" {

#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define FORMAT_PREFIX "I"
#elif defined(FORMAT_32BIT) || \
(defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1900)) || \
#elif defined(FORMAT_32BIT) || \
(defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1900)) || \
defined(_BSD_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || \
defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
#define FORMAT_PREFIX "z"
Expand Down
2 changes: 1 addition & 1 deletion source/loader/source/loader_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define LOADER_IMPL_FUNCTION_INIT "__metacall_initialize__"
#define LOADER_IMPL_FUNCTION_FINI "__metacall_finalize__"

#if defined(WIN32) || defined(_WIN32) || \
#if defined(WIN32) || defined(_WIN32) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__MINGW32__) || defined(__MINGW64__)

Expand Down
12 changes: 6 additions & 6 deletions source/loaders/file_loader/source/file_loader_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ typedef struct _stat file_stat_type;

#define file_stat _stat

#elif defined(unix) || defined(__unix__) || defined(__unix) || \
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__MINGW32__) || defined(__MINGW64__) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__MINGW32__) || defined(__MINGW64__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__)

#include <sys/stat.h>
Expand All @@ -68,10 +68,10 @@ typedef struct stat file_stat_type;
#endif

/* Support for glob, only in POSIX for now (TODO: Implement Windows support) */
#if !defined(_WIN32) && \
(defined(unix) || defined(__unix__) || defined(__unix) || \
#if !defined(_WIN32) && \
(defined(unix) || defined(__unix__) || defined(__unix) || \
defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
defined(__CYGWIN__) || defined(__CYGWIN32__) || \
(defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__))

#include <unistd.h>
Expand Down
6 changes: 3 additions & 3 deletions source/loaders/node_loader/source/node_loader_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ namespace node
extern bool linux_at_secure;
}

#define NODE_GET_EVENT_LOOP \
(NAPI_VERSION >= 2) && \
((NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10) || \
#define NODE_GET_EVENT_LOOP \
(NAPI_VERSION >= 2) && \
((NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10) || \
(NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3) || \
(NODE_MAJOR_VERSION >= 10))

Expand Down
Loading

0 comments on commit 5d4f0fa

Please sign in to comment.