Permalink
Browse files

Style: Reformat code with ClangFormat 6.0

  • Loading branch information...
sanssecours committed Aug 27, 2018
1 parent 6f3269d commit d3616b72ad66b367fe52363b05117c331673be4a
Showing with 227 additions and 86 deletions.
  1. +2 −6 .clang-format
  2. +1 −1 doc/news/_preparation_next_release.md
  3. +6 −1 examples/kdbset.c
  4. +2 −2 scripts/docker/debian/sid/Dockerfile
  5. +5 −5 scripts/jenkins/Jenkinsfile
  6. +2 −2 scripts/reformat-source
  7. +2 −1 src/bindings/cpp/include/kdbtimer.hpp
  8. +8 −5 src/bindings/glib/gelektra-key.c
  9. +2 −1 src/bindings/io/doc/io_doc.c
  10. +8 −2 src/include/kdbglobal.h
  11. +2 −1 src/include/kdbio.h
  12. +2 −1 src/include/kdbio/adapters/zeromq.h
  13. +2 −1 src/include/kdblogger.h
  14. +2 −1 src/include/kdbplugin.h
  15. +2 −1 src/include/kdbpluginprocess.h
  16. +4 −1 src/include/kdbprivate.h
  17. +6 −3 src/include/kdbproposal.h
  18. +5 −1 src/libs/elektra/kdb.c
  19. +2 −1 src/libs/tools/benchmarks/benchmark_crypto_comparison.cpp
  20. +2 −1 src/libs/tools/include/merging/mergeconflict.hpp
  21. +6 −1 src/libs/tools/include/merging/mergeconflictstrategy.hpp
  22. +2 −1 src/libs/tools/include/plugindatabase.hpp
  23. +2 −1 src/plugins/boolean/boolean.c
  24. +2 −1 src/plugins/camel/camel.c
  25. +9 −3 src/plugins/conditionals/conditionals.c
  26. +4 −2 src/plugins/crypto/crypto.h
  27. +4 −2 src/plugins/crypto/gpg.c
  28. +10 −3 src/plugins/curlget/curlget.c
  29. +4 −2 src/plugins/date/date.h
  30. +2 −1 src/plugins/fcrypt/fcrypt.c
  31. +9 −1 src/plugins/filecheck/filecheck.h
  32. +4 −2 src/plugins/gitresolver/gitresolver.c
  33. +2 −1 src/plugins/glob/glob.c
  34. +6 −1 src/plugins/ini/ini.c
  35. +9 −1 src/plugins/lineendings/lineendings.c
  36. +28 −5 src/plugins/list/list.c
  37. +2 −1 src/plugins/mathcheck/mathcheck.c
  38. +2 −1 src/plugins/mozprefs/mozprefs.c
  39. +6 −3 src/plugins/multifile/multifile.c
  40. +2 −1 src/plugins/passwd/passwd.c
  41. +2 −1 src/plugins/range/range.c
  42. +2 −1 src/plugins/resolver/shared.h
  43. +5 −1 src/plugins/semlock/semlock.c
  44. +14 −3 src/plugins/spec/spec.c
  45. +2 −1 src/plugins/xmltool/kdbtools.h
  46. +2 −1 src/plugins/yajl/yajl_gen.h
  47. +7 −2 src/tools/kdb/ansicolors.hpp
  48. +2 −1 src/tools/qt-gui/src/markdownconverter/markdownconverter.h
  49. +6 −1 src/tools/qt-gui/src/markdownconverter/template/template.h
  50. +2 −1 src/tools/qt-gui/src/treeviewmodel.hpp
  51. +1 −1 tests/shell/check_formatting.sh
View
@@ -14,10 +14,7 @@ BraceWrapping:
BeforeCatch: true
AfterClass: true
AfterControlStatement: true
# We do not add a newline after `enum` since Clang-Format 5 **does not** add a
# newline after `typedef enum`, even if we set `AfterEnum` to true.
# TODO: Enable the option below after we switched to `clang-format-6` or newer.
# AfterEnum: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
@@ -33,8 +30,7 @@ ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
#TODO: Set `FixNamespaceComments` to `true` after we switched to `clang-format-6` or newer.
#FixNamespaceComments: true
FixNamespaceComments: true
FixNamespaceComments: false
IndentCaseLabels: false
IndentWidth: 8
@@ -152,7 +152,7 @@ you up to date with the multi-language support provided by Elektra.
## Scripts
- <<TODO>>
- We reformatted the codebase using [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) 6.0. *(René Schwaiger)*
- <<TODO>>
- <<TODO>>
View
@@ -10,7 +10,12 @@
#include <stdio.h>
typedef enum { INPUT_USE_OURS, INPUT_DO_MERGE, INPUT_USE_THEIRS } input;
typedef enum
{
INPUT_USE_OURS,
INPUT_DO_MERGE,
INPUT_USE_THEIRS
} input;
int showElektraErrorDialog (Key * parentKey, Key * problemKey)
{
@@ -7,8 +7,8 @@ ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get -y install \
curl \
build-essential \
clang-5.0 \
clang-format-5.0 \
clang-6.0 \
clang-format-6.0 \
autotools-dev \
automake \
cmake \
@@ -68,8 +68,8 @@ CMAKE_FLAGS_BUILD_ALL = [
CMAKE_FLAGS_COVERAGE = ['ENABLE_COVERAGE': 'ON']
CMAKE_FLAGS_CLANG = [
'CMAKE_C_COMPILER': 'clang-5.0',
'CMAKE_CXX_COMPILER': 'clang++-5.0'
'CMAKE_C_COMPILER': 'clang-6.0',
'CMAKE_CXX_COMPILER': 'clang++-6.0'
]
CMAKE_FLAGS_INI = [
@@ -216,8 +216,8 @@ def dockerInit() {
/* We use the sid image for testing if we are compatible with Debian
* unstable.
* Additionally we use it for tests with Clang-5.0 and for source
* formatting checks (as they depend on Clang-5.0).
* Additionally we use it for tests with Clang-6.0 and for source
* formatting checks (as they depend on Clang-6.0).
*/
DOCKER_IMAGES.sid = createDockerImageDesc(
"debian-sid", this.&idTesting,
@@ -491,7 +491,7 @@ def generateFullBuildStages() {
[TEST.ALL, TEST.MEM, TEST.INSTALL]
)
// Build Elektra with clang. We use unstable for easy access to clang-5.0
// Build Elektra with clang. We use unstable for easy access to clang-6.0
// Detects problems when using an alternative compiler (clang)
tasks << buildAndTest(
"debian-stable-full-i386",
View
@@ -8,14 +8,14 @@
SCRIPTS_DIR=$(dirname "$0")
. "${SCRIPTS_DIR}/include-common"
CLANG_FORMAT=$(which clang-format-5.0 2> /dev/null)
CLANG_FORMAT=$(which clang-format-6.0 2> /dev/null)
if [ -z "${CLANG_FORMAT}" ]; then
CLANG_FORMAT=$(which clang-format)
fi
if [ -z "${CLANG_FORMAT}" ]; then
echo "Please install clang-format 5, 6, or 7"
echo "Please install clang-format 6, or 7"
exit 0
fi
@@ -23,7 +23,8 @@ class Timer
{
public:
// options what to do at cleanup
enum option_t {
enum option_t
{
raw_data_cerr, ///< print name,data\n (default!)
median_cerr, ///< print name,median\n
quiet, ///< print nothing
@@ -2,11 +2,14 @@
#include <kdbprivate.h>
#include <string.h>
enum { PROP_0,
PROP_KEY_NAME, ///< property to get the name of the key
PROP_KEY_BASENAME,
PROP_KEY_FULLNAME,
N_PROPERTIES };
enum
{
PROP_0,
PROP_KEY_NAME, ///< property to get the name of the key
PROP_KEY_BASENAME,
PROP_KEY_FULLNAME,
N_PROPERTIES
};
G_DEFINE_TYPE (GElektraKey, gelektra_key, G_TYPE_OBJECT)
static Key * gelektra_key_swap (GElektraKey * key, Key * newkey);
@@ -236,7 +236,8 @@ typedef struct SomeIoLibHandle
/**
* Example I/O mangement library bitmask flags
*/
typedef enum {
typedef enum
{
/** indicates that the file descriptor is readable */
SOME_IOLIB_READABLE = 1 << 0,
View
@@ -52,9 +52,15 @@
#define GENERATE_STRING(STRING) #STRING,
// clang-format on
typedef enum { FOREACH_POSITION (GENERATE_ENUM) } GlobalpluginPositions;
typedef enum
{
FOREACH_POSITION (GENERATE_ENUM)
} GlobalpluginPositions;
typedef enum { FOREACH_SUBPOSITION (GENERATE_ENUM) } GlobalpluginSubPositions;
typedef enum
{
FOREACH_SUBPOSITION (GENERATE_ENUM)
} GlobalpluginSubPositions;
static const char * GlobalpluginPositionsStr[] ELEKTRA_UNUSED = { FOREACH_POSITION (GENERATE_STRING) };
View
@@ -62,7 +62,8 @@ typedef void (*ElektraIoTimerCallback) (ElektraIoTimerOperation * timerOp);
/**
* Available flags for file descriptors operation bitmask
*/
typedef enum {
typedef enum
{
/** file descriptor is readable */
ELEKTRA_IO_READABLE = 1 << 0,
@@ -16,7 +16,8 @@
/** callback types */
typedef enum {
typedef enum
{
/** callback is called when socket is readable */
ELEKTRA_IO_ADAPTER_ZEROMQCB_READ = 1 << 0,
View
@@ -11,7 +11,8 @@
#include "kdbconfig.h"
enum ElektraLogLevel {
enum ElektraLogLevel
{
/**
* @brief assertion failed, will abort
*
View
@@ -72,7 +72,8 @@
*
* @ingroup backend
*/
typedef enum {
typedef enum
{
// clang-format off
ELEKTRA_PLUGIN_OPEN=1, /*!< Next arg is backend for kdbOpen() */
ELEKTRA_PLUGIN_CLOSE=1<<1, /*!< Next arg is backend for kdbClose() */
@@ -17,7 +17,8 @@ extern "C" {
* allow this library to possibly be extended to further commands in
* the future
*/
typedef enum {
typedef enum
{
// clang-format off
ELEKTRA_PLUGINPROCESS_OPEN=1, /*!< Call the plugin's open function */
ELEKTRA_PLUGINPROCESS_CLOSE=1<<1, /*!< Call the plugin's close function */
View
@@ -84,7 +84,10 @@ typedef int (*CloseMapper) (Backend *);
* Key Flags
*****************/
enum { KEY_EMPTY_NAME = 1 << 22 };
enum
{
KEY_EMPTY_NAME = 1 << 22
};
// clang-format off
@@ -33,7 +33,8 @@ KeySet * ksRenameKeys (KeySet * config, const Key * name);
*
* @ingroup proposal
*/
enum elektraLockOptions {
enum elektraLockOptions
{
KEY_LOCK_NAME = 1 << 17, ///< lock the name of a key
KEY_LOCK_VALUE = 1 << 18,
KEY_LOCK_META = 1 << 19
@@ -44,7 +45,8 @@ enum elektraLockOptions {
*
* @ingroup proposal
*/
enum elektraLookupOptions {
enum elektraLookupOptions
{
KDB_O_SPEC = 1 << 15, ///< Use the passed key as specification, instead of looking up the specification first
KDB_O_CREATE = 1 << 16, ///< Create the key if it was not found
KDB_O_NOCASCADING = 1 << 17, ///< Disable cascading search for keys starting with /
@@ -66,7 +68,8 @@ Key * ksPrev (KeySet * ks);
Key * ksPopAtCursor (KeySet * ks, cursor_t c);
typedef enum {
typedef enum
{
ELEKTRA_REL_BELOW_SAME_NS = 1 << 0, // Below Same Namespace, cascading namespace matches only cascading namespace
ELEKTRA_REL_BELOW_IGNORE_NS = 1 << 1, // Below Ignore Namespace, namespaces are ignored
ELEKTRA_REL_BELOW_CASCADING_NS = 1 << 2, // Below (allow) Cascading Namespace, cascading namespace matches all namespaces
View
@@ -536,7 +536,11 @@ static int elektraGetDoUpdate (Split * split, Key * parentKey)
return 0;
}
typedef enum { FIRST, LAST } UpdatePass;
typedef enum
{
FIRST,
LAST
} UpdatePass;
static KeySet * prepareGlobalKS (KeySet * ks, Key * parentKey)
{
@@ -21,7 +21,8 @@ extern "C" char ** environ;
// test key is located at src/plugins/crypto/test_key.asc
#define GPG_TEST_KEY_ID "DDEBEF9EE2DC931701338212DAF635B17F230E8D"
enum PluginVariant {
enum PluginVariant
{
NO_CRYPTO = 0, ///< use no crypto variant
CRYPTO_OPENSSL = 1,
CRYPTO_GCRYPT = 2,
@@ -28,7 +28,8 @@ class InvalidConflictOperation : public ToolException
explicit InvalidConflictOperation (std::string message) : ToolException (message){};
};
enum ConflictOperation {
enum ConflictOperation
{
CONFLICT_ADD, ///< Conflict because of adding key
CONFLICT_DELETE,
CONFLICT_MODIFY,
@@ -22,7 +22,12 @@ namespace tools
namespace merging
{
enum ConflictResolutionSide { BASE, OURS, THEIRS };
enum ConflictResolutionSide
{
BASE,
OURS,
THEIRS
};
class MergeConflictStrategy
{
@@ -55,7 +55,8 @@ class PluginDatabase
// virtual void registerPlugin(PluginSpec) = 0;
// virtual std::vector<PluginSpec> listAllPlugins() const = 0;
enum Status {
enum Status
{
/// does not directly, but can be loaded via provides
provides,
/// exists and working as given
@@ -21,7 +21,8 @@
#define DEFAULT_TRUE_VALUE "1"
#define DEFAULT_FALSE_VALUE "0"
typedef enum {
typedef enum
{
TRUE = 1 << 0,
FALSE = 1 << 1,
WARNING = 1 << 2,
@@ -30,7 +30,8 @@
/* -- Data Structures ------------------------------------------------------------------------------------------------------------------- */
/** This enum specifies the possible states of the recursive descent parser. */
typedef enum {
typedef enum
{
/** Unable to open file */
ERROR_FILE_OPEN,
/** Unable to close file */
@@ -31,7 +31,8 @@
#define REGEX_FLAGS_CONDITION (REG_EXTENDED)
typedef enum {
typedef enum
{
EQU,
NOT,
LT,
@@ -44,9 +45,14 @@ typedef enum {
OR,
} Comparator;
typedef enum { CONDITION, ASSIGN } Operation;
typedef enum
{
CONDITION,
ASSIGN
} Operation;
typedef enum {
typedef enum
{
TRUE = 1,
FALSE = 0,
ERROR = -1,
@@ -17,7 +17,8 @@
* List of flags that are put into the crypto payload header.
* Used to identify the data type of the encrypted content.
*/
enum ElektraCryptoHeaderFlags {
enum ElektraCryptoHeaderFlags
{
/** Regular binary data */
ELEKTRA_CRYPTO_FLAG_NONE = 0,
@@ -32,7 +33,8 @@ enum ElektraCryptoHeaderFlags {
/**
* Defines the modes of operation of the crypto plugin.
*/
enum ElektraCryptoOperation {
enum ElektraCryptoOperation
{
/** Encryption mode */
ELEKTRA_CRYPTO_ENCRYPT = 0,
View
@@ -30,7 +30,8 @@
/**
* List of states for the state machine that parses the gpg key list output.
*/
enum gpgKeyListState {
enum gpgKeyListState
{
GPG_KEYLIST_STATE_START,
GPG_KEYLIST_STATE_FPR2,
GPG_KEYLIST_STATE_FPR3,
@@ -42,7 +43,8 @@ enum gpgKeyListState {
* Return codes for the forked child process that starts the gpg binary.
* List of possible errors.
*/
enum gpgCallErrorCode {
enum gpgCallErrorCode
{
/** Failed to duplicate the stdin pipe */
GPG_CALL_DUP_STDIN = 0x4200,
Oops, something went wrong.

0 comments on commit d3616b7

Please sign in to comment.