Skip to content

Commit

Permalink
Change style for trailing comments to aligned.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgr committed Feb 16, 2017
1 parent 3b32059 commit 9cf0b39
Show file tree
Hide file tree
Showing 22 changed files with 93 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
Expand Down
4 changes: 2 additions & 2 deletions .travis/checkStyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ for f in $(git diff --name-only --diff-filter=ACMRTUXB $1); do
if ! echo "$f" | egrep -q "^src/"; then
continue
fi
d=$(diff -u0 "$f" <(/usr/bin/clang-format -style=file $(changedLines $1 $f) "$f")) || true
d=$(diff -u0 "$f" <(/usr/bin/clang-format -style=file "$f")) || true
if [ -n "$d" ]; then
echo "!!! $f not compliant to coding style. A suggested fix is below."
echo "To make the fix automatically, use clang-format -i $(changedLines $1 $f) $f"
echo "To make the fix automatically, use clang-format -i $f"
echo
echo "$d"
echo
Expand Down
2 changes: 1 addition & 1 deletion src/AstType.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class AstRecordType : public AstType {
public:
/** The type utilized to model a field */
struct Field {
std::string name; // < the field name
std::string name; // < the field name
AstTypeIdentifier type; // < the field type

bool operator==(const Field& other) const {
Expand Down
44 changes: 22 additions & 22 deletions src/BinaryOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ namespace souffle {
*/
enum class BinaryRelOp {
__UNDEFINED__, // undefined operator
EQ, // equivalence of two values
NE, // whether two values are different
LT, // less-than
LE, // less-than-or-equal-to
GT, // greater-than
GE, // greater-than-or-equal-to
MATCH, // matching string
CONTAINS, // whether a sub-string is contained in a string
NOT_MATCH, // not matching string
NOT_CONTAINS // whether a sub-string is not contained in a string
EQ, // equivalence of two values
NE, // whether two values are different
LT, // less-than
LE, // less-than-or-equal-to
GT, // greater-than
GE, // greater-than-or-equal-to
MATCH, // matching string
CONTAINS, // whether a sub-string is contained in a string
NOT_MATCH, // not matching string
NOT_CONTAINS // whether a sub-string is not contained in a string
};

inline BinaryRelOp negate(BinaryRelOp op) {
Expand Down Expand Up @@ -153,18 +153,18 @@ inline bool isSymbolicBinaryRelOp(const BinaryRelOp op) {
*/
enum class BinaryOp {
__UNDEFINED__, // undefined operator
ADD, // addition
SUB, // subtraction
MUL, // multiplication
DIV, // division
EXP, // exponent
MOD, // modulus
BAND, // bitwise and
BOR, // bitwise or
BXOR, // bitwise exclusive or
LAND, // logical and
LOR, // logical or
CAT, // string concatenation
ADD, // addition
SUB, // subtraction
MUL, // multiplication
DIV, // division
EXP, // exponent
MOD, // modulus
BAND, // bitwise and
BOR, // bitwise or
BXOR, // bitwise exclusive or
LAND, // logical and
LOR, // logical or
CAT, // string concatenation
};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/CompiledRamIndexUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct check_arity<arity, F, Rest...> {
template <unsigned arity, typename... Indices>
struct check {
enum {
value = unique<Indices...>::value && // indices need to be unique
value = unique<Indices...>::value && // indices need to be unique
check_arity<arity, Indices...>::value // and valid
};
};
Expand Down Expand Up @@ -948,8 +948,8 @@ template <typename T, typename Index>
struct direct_index_factory<T, Index, true> {
// the arity of the tuple type determines the type of index
typedef typename std::conditional<T::arity <= 2, // if the arity is <= 2
TrieIndex<Index>, // .. we use the faster Trie index
DirectIndex<T, Index> // .. otherwise we fall back to the B-Tree index
TrieIndex<Index>, // .. we use the faster Trie index
DirectIndex<T, Index> // .. otherwise we fall back to the B-Tree index
>::type type;
// typedef DirectIndex<T,Index> type;
};
Expand Down
2 changes: 1 addition & 1 deletion src/CompiledRamRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class RecordMap {
{
// lock pack operation
auto leas = pack_lock.acquire(); // lock hold till end of scope
(void)leas; // avoid warning
(void)leas; // avoid warning

// try lookup
auto pos = r2i.find(tuple);
Expand Down
10 changes: 5 additions & 5 deletions src/Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ class BaseTable {

/* Struct to represent an option given to the main function by command line arguments. */
struct MainOption {
std::string longName; /* The long name for this option, e.g. 'option' for '--option'. */
char shortName; /* The short name for this option where a non-character option means none will be
displayed, e.g. 'o' for '-o'. */
std::string argument; /* The argument this option, e.g. if longName is 'option', shortName is 'o', and
argument is 'ARG', then we have '-o=ARG' and '--option=ARG'. */
std::string longName; /* The long name for this option, e.g. 'option' for '--option'. */
char shortName; /* The short name for this option where a non-character option means none will be
displayed, e.g. 'o' for '-o'. */
std::string argument; /* The argument this option, e.g. if longName is 'option', shortName is 'o', and
argument is 'ARG', then we have '-o=ARG' and '--option=ARG'. */
std::string byDefault; /* The default value for this option, used if no this option is not specified as a
command line argument. */
bool takesMany; /* Whether this option takes many arguments, false for 'it takes only one' true for 'it
Expand Down
4 changes: 2 additions & 2 deletions src/GraphUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ namespace souffle {
template <typename Node, typename Compare = std::less<Node>>
class Graph {
// not a very efficient but simple graph representation
std::set<Node, Compare> nodes; // all the nodes in the graph
std::map<Node, std::set<Node, Compare>> forward; // all edges forward directed
std::set<Node, Compare> nodes; // all the nodes in the graph
std::map<Node, std::set<Node, Compare>> forward; // all edges forward directed
std::map<Node, std::set<Node, Compare>> backward; // all edges backward

public:
Expand Down
4 changes: 2 additions & 2 deletions src/RamAutoIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class RamAutoIndex {
typedef std::vector<Chain> ChainOrderMap;
typedef std::set<SearchColumns> SearchSet;

SearchSet searches; // set of search patterns on table
OrderCollection orders; // collection of lexicographical orders
SearchSet searches; // set of search patterns on table
OrderCollection orders; // collection of lexicographical orders
ChainOrderMap chainToOrder; // maps order index to set of searches covered by chain

RamMaxMatching matching; // matching problem for finding minimal number of orders
Expand Down
4 changes: 2 additions & 2 deletions src/RamExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1969,9 +1969,9 @@ std::string RamCompiler::generateCode(
os << "SymbolTable symTable;\n";

// print relation definitions
std::string initCons; // initialization of constructor
std::string initCons; // initialization of constructor
std::string deleteForNew; // matching deletes for each new, used in the destructor
std::string registerRel; // registration of relations
std::string registerRel; // registration of relations
int relCtr = 0;
std::string tempType; // string to hold the type of the temporary relations
visitDepthFirst(stmt, [&](const RamCreate& create) {
Expand Down
2 changes: 1 addition & 1 deletion src/RamIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class RamIndex {

private:
const RamIndexOrder theOrder; // retain the index order used to construct an object of this class
index_set set; // set storing tuple pointers of table
index_set set; // set storing tuple pointers of table

public:
RamIndex(const RamIndexOrder& order) : theOrder(order), set(comparator(theOrder)) {}
Expand Down
4 changes: 2 additions & 2 deletions src/RamMaxMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class RamMaxMatching {
typedef std::map<SearchColumns, int> Distance;

private:
Matchings match; // if x not in match assume match[x] == 0 else a value. Needs both edges...
Graph graph; // Only traversed not modified
Matchings match; // if x not in match assume match[x] == 0 else a value. Needs both edges...
Graph graph; // Only traversed not modified
Distance distance; // if x not in distance assume distance[x] == inf. distance [0] special

public:
Expand Down
4 changes: 2 additions & 2 deletions src/RamTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ namespace {
* The location of some value in a loop nest.
*/
struct Location {
int level; // < the loop level
int component; // < the component within the tuple created in the given level
int level; // < the loop level
int component; // < the component within the tuple created in the given level
std::string name; // < name of the variable

bool operator==(const Location& loc) const {
Expand Down
6 changes: 3 additions & 3 deletions src/RuleScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ typedef int Var;
class Argument {
/** The type of argument */
enum Kind {
Variable, // < Named variables, require to expose and ID
Constant, // < constants, no ID
Variable, // < Named variables, require to expose and ID
Constant, // < constants, no ID
UnnamedVar, // < underscore, no ID
Other // < others, no ID
Other // < others, no ID
};

/** The kind of argument represented */
Expand Down
2 changes: 1 addition & 1 deletion src/SouffleInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class ProgramFactory {
// container needs to be a primitive type such as pointer
// set to NULL.
ProgramFactory* link; // link to next factory
std::string name; // name of factory
std::string name; // name of factory

protected:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Trie.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class SparseArray {
};

union {
RootInfo unsynced; // for sequential operations
RootInfo unsynced; // for sequential operations
volatile RootInfo synced; // for synchronized operations
};

Expand Down
30 changes: 15 additions & 15 deletions src/UnaryOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ namespace souffle {
*/
enum class UnaryOp {
__UNDEFINED__,
ORD, // character value
NEG, // numeric negation
BNOT, // bitwise negation
LNOT, // logical negation
SIN, // mathematical sin
COS, // mathematical cos
TAN, // mathematical tan
ASIN, // mathematical asin
ACOS, // mathematical acos
ATAN, // mathematical atan
SINH, // mathematical sinh
COSH, // mathematical cosh
TANH, // mathematical tanh
ORD, // character value
NEG, // numeric negation
BNOT, // bitwise negation
LNOT, // logical negation
SIN, // mathematical sin
COS, // mathematical cos
TAN, // mathematical tan
ASIN, // mathematical asin
ACOS, // mathematical acos
ATAN, // mathematical atan
SINH, // mathematical sinh
COSH, // mathematical cosh
TANH, // mathematical tanh
ASINH, // mathematical asinh
ACOSH, // mathematical acosh
ATANH, // mathematical atanh
LOG, // mathematical natural logarithm
EXP // mathematical natural exponent
LOG, // mathematical natural logarithm
EXP // mathematical natural exponent
};

/**
Expand Down
31 changes: 14 additions & 17 deletions src/mcpp_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@
#define _MCPP_LIB_H

#ifndef _MCPP_OUT_H
#include "mcpp_out.h" /* declaration of OUTDEST */
#include "mcpp_out.h" /* declaration of OUTDEST */
#endif

#if _WIN32 || _WIN64 || __CYGWIN__ || __CYGWIN64__ || __MINGW32__ \
|| __MINGW64__
#if DLL_EXPORT || (__CYGWIN__ && PIC)
#define DLL_DECL __declspec( dllexport)
#elif DLL_IMPORT
#define DLL_DECL __declspec( dllimport)
#if _WIN32 || _WIN64 || __CYGWIN__ || __CYGWIN64__ || __MINGW32__ || __MINGW64__
#if DLL_EXPORT || (__CYGWIN__ && PIC)
#define DLL_DECL __declspec(dllexport)
#elif DLL_IMPORT
#define DLL_DECL __declspec(dllimport)
#else
#define DLL_DECL
#endif
#else
#define DLL_DECL
#endif

extern DLL_DECL int mcpp_lib_main( int argc, char ** argv);
extern DLL_DECL void mcpp_reset_def_out_func( void);
extern DLL_DECL void mcpp_set_out_func(
int (* func_fputc) ( int c, OUTDEST od),
int (* func_fputs) ( const char * s, OUTDEST od),
int (* func_fprintf)( OUTDEST od, const char * format, ...)
);
extern DLL_DECL void mcpp_use_mem_buffers( int tf);
extern DLL_DECL char * mcpp_get_mem_buffer( OUTDEST od);
#endif /* _MCPP_LIB_H */
extern DLL_DECL int mcpp_lib_main(int argc, char** argv);
extern DLL_DECL void mcpp_reset_def_out_func(void);
extern DLL_DECL void mcpp_set_out_func(int (*func_fputc)(int c, OUTDEST od),
int (*func_fputs)(const char* s, OUTDEST od),
int (*func_fprintf)(OUTDEST od, const char* format, ...));
extern DLL_DECL void mcpp_use_mem_buffers(int tf);
extern DLL_DECL char* mcpp_get_mem_buffer(OUTDEST od);
#endif /* _MCPP_LIB_H */
8 changes: 4 additions & 4 deletions src/mcpp_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/* Choices for output destination */
typedef enum {
OUT, /* ~= fp_out */
ERR, /* ~= fp_err */
DBG, /* ~= fp_debug */
OUT, /* ~= fp_out */
ERR, /* ~= fp_err */
DBG, /* ~= fp_debug */
NUM_OUTDEST
} OUTDEST;

#endif /* _MCPP_OUT_H */
#endif /* _MCPP_OUT_H */
10 changes: 5 additions & 5 deletions src/test/ast_utils_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ TEST(AstUtils, Const) {
// check selected sub-terms
auto head = clause->getHead();
EXPECT_FALSE(isConst[head->getArgument(0)]); // X
EXPECT_TRUE(isConst[head->getArgument(1)]); // Y
EXPECT_TRUE(isConst[head->getArgument(2)]); // Z
EXPECT_TRUE(isConst[head->getArgument(3)]); // W
EXPECT_TRUE(isConst[head->getArgument(1)]); // Y
EXPECT_TRUE(isConst[head->getArgument(2)]); // Z
EXPECT_TRUE(isConst[head->getArgument(3)]); // W
}

TEST(AstUtils, Grounded) {
Expand Down Expand Up @@ -111,8 +111,8 @@ TEST(AstUtils, Grounded) {
auto isGrounded = getGroundedTerms(*clause);

// check selected sub-terms
EXPECT_TRUE(isGrounded[head->getArgument(0)]); // X
EXPECT_TRUE(isGrounded[head->getArgument(1)]); // Y
EXPECT_TRUE(isGrounded[head->getArgument(0)]); // X
EXPECT_TRUE(isGrounded[head->getArgument(1)]); // Y
EXPECT_FALSE(isGrounded[head->getArgument(2)]); // Z

// done
Expand Down
4 changes: 2 additions & 2 deletions src/test/symbol_table_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ TEST(SymbolTable, Inserts) {
typedef unsigned long long T;
time_point start, end;

T n = 0; // counter
T n = 0; // counter
T N = 10000000; // number of symbols to insert

SymbolTable X;
Expand All @@ -119,7 +119,7 @@ TEST(SymbolTable, Inserts) {
X.insert(x); // insert one at a time
end = now();
n += duration_in_ns(start, end); // record the time
A[i] = x; // also put in the array
A[i] = x; // also put in the array
}

if (ECHO_TIME)
Expand Down
4 changes: 2 additions & 2 deletions src/test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ static class TestCase* base = nullptr;

class TestCase {
private:
TestCase* next; // next test case (linked by constructor)
TestCase* next; // next test case (linked by constructor)
std::string group; // group name of test
std::string test; // test name of test
std::string test; // test name of test
size_t num_checks; // number of checks
size_t num_failed; // number of failed checks

Expand Down

0 comments on commit 9cf0b39

Please sign in to comment.