Skip to content

Commit 501b16f

Browse files
authored
werror (#5)
1 parent 848a2f3 commit 501b16f

4 files changed

Lines changed: 91 additions & 28 deletions

File tree

.clang-format

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
AccessModifierOffset: -4
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: true
4+
AlignEscapedNewlinesLeft: false
5+
AlignOperands: true
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: true
8+
AllowShortBlocksOnASingleLine: true
9+
AllowShortCaseLabelsOnASingleLine: true
10+
AllowShortFunctionsOnASingleLine: Inline
11+
AllowShortIfStatementsOnASingleLine: false
12+
AllowShortLoopsOnASingleLine: false
13+
AlwaysBreakAfterReturnType: None
14+
AlwaysBreakBeforeMultilineStrings: false
15+
AlwaysBreakTemplateDeclarations: true
16+
BreakBeforeBraces: Custom
17+
BraceWrapping:
18+
AfterFunction: true
19+
AfterClass: true
20+
AfterControlStatement: true
21+
AfterEnum: false
22+
AfterNamespace: true
23+
AfterStruct: true
24+
AfterUnion: true
25+
BeforeCatch: true
26+
BeforeElse: true
27+
BinPackArguments: true
28+
BinPackParameters: true
29+
BreakBeforeBinaryOperators: All
30+
BreakBeforeTernaryOperators: true
31+
BreakConstructorInitializersBeforeComma: true
32+
BreakStringLiterals: true
33+
ColumnLimit: 100
34+
CommentPragmas: '^ IWYU pragma:'
35+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
36+
ConstructorInitializerIndentWidth: 4
37+
ContinuationIndentWidth: 4
38+
Cpp11BracedListStyle: true
39+
DerivePointerAlignment: false
40+
DisableFormat: false
41+
ExperimentalAutoDetectBinPacking: false
42+
IndentCaseLabels: true
43+
IndentWidth: 4
44+
IndentWrappedFunctionNames: false
45+
KeepEmptyLinesAtTheStartOfBlocks: false
46+
MaxEmptyLinesToKeep: 4
47+
NamespaceIndentation: Inner
48+
PenaltyBreakBeforeFirstCallParameter: 19
49+
PenaltyBreakComment: 300
50+
PenaltyBreakFirstLessLess: 120
51+
PenaltyBreakString: 1000
52+
PenaltyExcessCharacter: 1000000
53+
PenaltyReturnTypeOnItsOwnLine: 60
54+
PointerAlignment: Left
55+
ReflowComments: true
56+
SortIncludes: false
57+
SpaceAfterTemplateKeyword: false
58+
SpaceBeforeAssignmentOperators: true
59+
SpaceBeforeParens: ControlStatements
60+
SpaceInEmptyParentheses: false
61+
SpacesBeforeTrailingComments: 1
62+
SpacesInAngles: false
63+
SpacesInCStyleCastParentheses: false
64+
SpacesInContainerLiterals: false
65+
SpacesInParentheses: false
66+
SpacesInSquareBrackets: false
67+
Standard: Cpp11
68+
TabWidth: 4
69+
UseTab: Never

.github/workflows/build_osx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
MKN_LIB_LINK_LIB: 1
1919
KUL_GIT_CO: --depth 1
2020
run: |
21-
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_osx
21+
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_arm_osx
2222
chmod +x mkn
2323
KLOG=2 ./mkn clean build run -dtOa "-std=c++17 -fPIC"

mod.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2828
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*/
31-
#include "maiken/module/init.hpp"
3231
#include <cstdint>
3332
#include <unordered_set>
3433

34+
#include "maiken/module/init.hpp"
35+
3536
namespace mkn {
3637
namespace python3 {
3738

3839
class ModuleMaker : public maiken::Module {
39-
private:
40+
private:
4041
#if defined(_WIN32)
4142
const bool config_expected = 0;
4243
#else
@@ -49,45 +50,40 @@ class ModuleMaker : public maiken::Module {
4950
mkn::kul::Dir bin;
5051
std::shared_ptr<kul::cli::EnvVar> path_var;
5152

52-
protected:
53+
protected:
5354
static void VALIDATE_NODE(YAML::Node const &node) {
5455
using namespace mkn::kul::yaml;
5556
Validator({NodeValidator("args")}).validate(node);
5657
}
5758

58-
public:
59-
void init(maiken::Application &a, YAML::Node const &node)
59+
public:
60+
void init(maiken::Application &a, YAML::Node const & /*node*/)
6061
KTHROW(std::exception) override {
6162
bool finally = 0;
62-
if (!kul::env::WHICH(PY.c_str()))
63-
PY = "python";
63+
if (!kul::env::WHICH(PY.c_str())) PY = "python";
6464
PYTHON = mkn::kul::env::GET("PYTHON");
65-
if (!PYTHON.empty())
66-
PY = PYTHON;
65+
if (!PYTHON.empty()) PY = PYTHON;
6766
#if defined(_WIN32)
68-
if (PY.rfind(".exe") == std::string::npos)
69-
PY += ".exe";
67+
if (PY.rfind(".exe") == std::string::npos) PY += ".exe";
7068
#endif
7169
mkn::kul::Process p(PY);
7270
mkn::kul::ProcessCapture pc(p);
7371
HOME = mkn::kul::env::GET("PYTHON3_HOME");
7472
if (!HOME.empty()) {
7573
#if defined(_WIN32)
7674
bin = mkn::kul::Dir(HOME);
77-
if (!bin)
78-
KEXCEPT(kul::Exception, "$PYTHON3_HOME does not exist");
75+
if (!bin) KEXCEPT(kul::Exception, "$PYTHON3_HOME does not exist");
7976
#else
8077
bin = mkn::kul::Dir("bin", HOME);
81-
if (!bin)
82-
KEXCEPT(kul::Exception, "$PYTHON3_HOME/bin does not exist");
78+
if (!bin) KEXCEPT(kul::Exception, "$PYTHON3_HOME/bin does not exist");
8379
#endif
8480
path_var = std::make_shared<kul::cli::EnvVar>(
8581
"PATH", bin.real(), mkn::kul::cli::EnvVarMode::PREP);
8682
mkn::kul::env::SET(path_var->name(), path_var->toString().c_str());
8783
p.var(path_var->name(), path_var->toString());
8884
};
8985
#if defined(_WIN32)
90-
pyconfig_found = false; // doesn't exist on windows (generally)
86+
pyconfig_found = false; // doesn't exist on windows (generally)
9187
#else
9288
pyconfig_found = mkn::kul::env::WHICH(PY3_CONFIG.c_str());
9389
#endif
@@ -111,18 +107,16 @@ class ModuleMaker : public maiken::Module {
111107
} catch (...) {
112108
KERR << "UNKNOWN ERROR CAUGHT";
113109
}
114-
if (finally)
115-
exit(2);
110+
if (finally) exit(2);
116111
using namespace mkn::kul::cli;
117-
auto &evs = a.envVars();
112+
118113
std::string extension;
119114
if (pyconfig_found) {
120115
mkn::kul::os::PushDir pushd(a.project().dir());
121116
mkn::kul::Process p(PY3_CONFIG);
122117
mkn::kul::ProcessCapture pc(p);
123118
p << "--extension-suffix";
124-
if (path_var)
125-
p.var(path_var->name(), path_var->toString());
119+
if (path_var) p.var(path_var->name(), path_var->toString());
126120
p.start();
127121
extension = pc.outs();
128122
} else {
@@ -134,13 +128,13 @@ class ModuleMaker : public maiken::Module {
134128
p.start();
135129
extension = pc.outs();
136130
}
137-
a.m_cInfo.lib_ext = mkn::kul::String::LINES(extension)[0]; // drop EOL
131+
a.m_cInfo.lib_ext = mkn::kul::String::LINES(extension)[0]; // drop EOL
138132
a.m_cInfo.lib_prefix = "";
139133
a.mode(maiken::compiler::Mode::SHAR);
140134
}
141135
};
142-
} // namespace python3
143-
} // namespace mkn
136+
} // namespace python3
137+
} // namespace mkn
144138

145139
extern "C" KUL_PUBLISH maiken::Module *maiken_module_construct() {
146140
return new mkn::python3::ModuleMaker;

test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

22

3+
#include <maiken.hpp>
4+
35
#include "mkn/kul/signal.hpp"
46
#include "mkn/kul/yaml.hpp"
5-
#include <maiken.hpp>
67

78
const std::string yArgs = "";
89

@@ -18,8 +19,7 @@ int main(int argc, char *argv[]) {
1819
loader->module()->link(*app, node);
1920
loader->module()->pack(*app, node);
2021
loader->unload();
21-
for (const auto inc : app->includes())
22-
KLOG(INF) << inc.first;
22+
for (const auto inc : app->includes()) KLOG(INF) << inc.first;
2323
} catch (const mkn::kul::Exception &e) {
2424
KLOG(ERR) << e.what();
2525
return 2;

0 commit comments

Comments
 (0)