diff options
| author | ruki <[email protected]> | 2025-11-09 19:51:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-09 19:51:04 +0800 |
| commit | 91f6ed08fe32e36d555129efa4afdd82113f0eb4 (patch) | |
| tree | 2bfee23488c8479c83833677262ee83b9e362cbb | |
| parent | c89c94bf89e98c8e42e786aacc0b334a57474179 (diff) | |
format tests and templates
155 files changed, 312 insertions, 381 deletions
diff --git a/core/.clang-format b/core/.clang-format index edad6bd70..2fbb26713 100644 --- a/core/.clang-format +++ b/core/.clang-format @@ -75,3 +75,8 @@ PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 1000 PenaltyBreakTemplateDeclaration: 1000 + +--- +Language: ObjC +BasedOnStyle: LLVM +DisableFormat: true diff --git a/tests/apis/add_allowedxxx/src/main.cpp b/tests/apis/add_allowedxxx/src/main.cpp index 7c435d251..55d2f380a 100644 --- a/tests/apis/add_allowedxxx/src/main.cpp +++ b/tests/apis/add_allowedxxx/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/apis/add_configfiles/main.c b/tests/apis/add_configfiles/main.c index 59d3c5669..139483db0 100644 --- a/tests/apis/add_configfiles/main.c +++ b/tests/apis/add_configfiles/main.c @@ -2,8 +2,7 @@ #include <stdlib.h> #include "config.h" -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { printf("hello %s\n", HELLO); return 0; } diff --git a/tests/apis/add_configfiles/main2.c b/tests/apis/add_configfiles/main2.c index 2bd25b908..c961d4b4e 100644 --- a/tests/apis/add_configfiles/main2.c +++ b/tests/apis/add_configfiles/main2.c @@ -2,8 +2,7 @@ #include <stdlib.h> #include "config2.h" -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { printf("hello2 %s\n", HELLO2); return 0; } diff --git a/tests/apis/add_defines/src/main.cpp b/tests/apis/add_defines/src/main.cpp index d16b296dc..b92ee9f34 100644 --- a/tests/apis/add_defines/src/main.cpp +++ b/tests/apis/add_defines/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << TEST1 << endl; cout << TEST2 << endl; cout << TEST3 << endl; diff --git a/tests/apis/add_deps/src/interface.c b/tests/apis/add_deps/src/interface.c index 598d07560..00d3b28d6 100644 --- a/tests/apis/add_deps/src/interface.c +++ b/tests/apis/add_deps/src/interface.c @@ -1,6 +1,5 @@ #include "interface.h" -int add(int a, int b) -{ +int add(int a, int b) { return a + b; } diff --git a/tests/apis/add_deps/src/interface.h b/tests/apis/add_deps/src/interface.h index ef24ba3ce..b1e1216f9 100644 --- a/tests/apis/add_deps/src/interface.h +++ b/tests/apis/add_deps/src/interface.h @@ -3,11 +3,11 @@ extern "C" { #endif #if defined(_WIN32) -# define __export __declspec(dllexport) +#define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define __export __attribute__((visibility("default"))) +#define __export __attribute__((visibility("default"))) #else -# define __export +#define __export #endif /*! calculate add(a, b) @@ -17,7 +17,7 @@ extern "C" { * * @return the result */ -__export int add(int a, int b); +__export int add(int a, int b); #ifdef __cplusplus } diff --git a/tests/apis/add_deps/src/main.c b/tests/apis/add_deps/src/main.c index 113930e1a..ccf4b2a77 100644 --- a/tests/apis/add_deps/src/main.c +++ b/tests/apis/add_deps/src/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("hello world!\n"); return 0; } diff --git a/tests/apis/check_xxx/foo.c b/tests/apis/check_xxx/foo.c index c055f5886..df779f2e6 100644 --- a/tests/apis/check_xxx/foo.c +++ b/tests/apis/check_xxx/foo.c @@ -1,6 +1,5 @@ #include "config.h" -int foo() -{ +int foo() { return 0; } diff --git a/tests/apis/check_xxx/main.c b/tests/apis/check_xxx/main.c index 9b130982d..11b7fad8e 100644 --- a/tests/apis/check_xxx/main.c +++ b/tests/apis/check_xxx/main.c @@ -1,3 +1,3 @@ -int main(int argc, char** argv) { +int main(int argc, char **argv) { return 0; } diff --git a/tests/apis/clone_target/src/main.cpp b/tests/apis/clone_target/src/main.cpp index db2361659..55d2f380a 100644 --- a/tests/apis/clone_target/src/main.cpp +++ b/tests/apis/clone_target/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ - cout << "hello world!" << endl; +int main(int argc, char **argv) { + cout << "hello world!" << endl; return 0; } diff --git a/tests/apis/custom_scopeapis/src/main.cpp b/tests/apis/custom_scopeapis/src/main.cpp index 7c435d251..55d2f380a 100644 --- a/tests/apis/custom_scopeapis/src/main.cpp +++ b/tests/apis/custom_scopeapis/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/apis/custom_toolchain/src/test.cpp b/tests/apis/custom_toolchain/src/test.cpp index 7cdb7d93f..66905a94c 100644 --- a/tests/apis/custom_toolchain/src/test.cpp +++ b/tests/apis/custom_toolchain/src/test.cpp @@ -1,5 +1,5 @@ #include "foo.h" -int main(int argc, char** argv) { +int main(int argc, char **argv) { return add(1, 2); } diff --git a/tests/apis/namespace/basic/src/main.cpp b/tests/apis/namespace/basic/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/basic/src/main.cpp +++ b/tests/apis/namespace/basic/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/includes/src/main.cpp b/tests/apis/namespace/includes/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/includes/src/main.cpp +++ b/tests/apis/namespace/includes/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/inner/src/main.cpp b/tests/apis/namespace/inner/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/inner/src/main.cpp +++ b/tests/apis/namespace/inner/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/nested/src/main.cpp b/tests/apis/namespace/nested/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/nested/src/main.cpp +++ b/tests/apis/namespace/nested/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/option/src/main.cpp b/tests/apis/namespace/option/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/option/src/main.cpp +++ b/tests/apis/namespace/option/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/package/src/main.cpp b/tests/apis/namespace/package/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/package/src/main.cpp +++ b/tests/apis/namespace/package/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/root/src/main.cpp b/tests/apis/namespace/root/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/root/src/main.cpp +++ b/tests/apis/namespace/root/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/rule/src/main.cpp b/tests/apis/namespace/rule/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/rule/src/main.cpp +++ b/tests/apis/namespace/rule/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/namespace/toolchain/src/main.cpp b/tests/apis/namespace/toolchain/src/main.cpp index 4cf7b5e62..b2c84c4bd 100644 --- a/tests/apis/namespace/toolchain/src/main.cpp +++ b/tests/apis/namespace/toolchain/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; std::cout << "sub(2, 1) = " << sub(2, 1) << std::endl; return 0; diff --git a/tests/apis/rules/src/main.c b/tests/apis/rules/src/main.c index b86c9ad8e..14d033f7a 100644 --- a/tests/apis/rules/src/main.c +++ b/tests/apis/rules/src/main.c @@ -1,8 +1,7 @@ #include <stdio.h> extern int test(int a, int b); -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { printf("1 + 1 = %d\n", test(1, 1)); return 0; } diff --git a/tests/apis/rules/src/main2.c b/tests/apis/rules/src/main2.c index 9a8264b1f..14d033f7a 100644 --- a/tests/apis/rules/src/main2.c +++ b/tests/apis/rules/src/main2.c @@ -1,7 +1,7 @@ #include <stdio.h> extern int test(int a, int b); -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("1 + 1 = %d\n", test(1, 1)); return 0; } diff --git a/tests/apis/rules_inject_deps/src/main.cpp b/tests/apis/rules_inject_deps/src/main.cpp index db2361659..55d2f380a 100644 --- a/tests/apis/rules_inject_deps/src/main.cpp +++ b/tests/apis/rules_inject_deps/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ - cout << "hello world!" << endl; +int main(int argc, char **argv) { + cout << "hello world!" << endl; return 0; } diff --git a/tests/apis/rules_order/src/main.c b/tests/apis/rules_order/src/main.c index d612d8782..e6173ef04 100644 --- a/tests/apis/rules_order/src/main.c +++ b/tests/apis/rules_order/src/main.c @@ -1,6 +1,5 @@ #include <stdio.h> -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { return 0; } diff --git a/tests/apis/set_toolchains/src/test.cpp b/tests/apis/set_toolchains/src/test.cpp index ed1924789..41e494481 100644 --- a/tests/apis/set_toolchains/src/test.cpp +++ b/tests/apis/set_toolchains/src/test.cpp @@ -3,7 +3,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; } diff --git a/tests/apis/target_get_from/src/main.cpp b/tests/apis/target_get_from/src/main.cpp index ed1924789..41e494481 100644 --- a/tests/apis/target_get_from/src/main.cpp +++ b/tests/apis/target_get_from/src/main.cpp @@ -3,7 +3,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; } diff --git a/tests/plugins/macro/src/main.cpp b/tests/plugins/macro/src/main.cpp index 7c775d288..9b6abffea 100644 --- a/tests/plugins/macro/src/main.cpp +++ b/tests/plugins/macro/src/main.cpp @@ -1,6 +1,6 @@ #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "hello world!" << std::endl; return 0; } diff --git a/tests/plugins/pack/src/main.cpp b/tests/plugins/pack/src/main.cpp index e64ad9bc2..55d2f380a 100644 --- a/tests/plugins/pack/src/main.cpp +++ b/tests/plugins/pack/src/main.cpp @@ -2,7 +2,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/console_zig_cxx/src/main.cpp b/tests/projects/c++/console_zig_cxx/src/main.cpp index 7c435d251..55d2f380a 100644 --- a/tests/projects/c++/console_zig_cxx/src/main.cpp +++ b/tests/projects/c++/console_zig_cxx/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/doctest/src/main.cpp b/tests/projects/c++/doctest/src/main.cpp index 7c435d251..55d2f380a 100644 --- a/tests/projects/c++/doctest/src/main.cpp +++ b/tests/projects/c++/doctest/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/manifest/src/main.cpp b/tests/projects/c++/manifest/src/main.cpp index db2361659..55d2f380a 100644 --- a/tests/projects/c++/manifest/src/main.cpp +++ b/tests/projects/c++/manifest/src/main.cpp @@ -2,8 +2,7 @@ using namespace std; -int main(int argc, char** argv) -{ - cout << "hello world!" << endl; +int main(int argc, char **argv) { + cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/modules/class/src/hello_impl.cpp b/tests/projects/c++/modules/class/src/hello_impl.cpp index 5dd555a7a..b09f4b96c 100644 --- a/tests/projects/c++/modules/class/src/hello_impl.cpp +++ b/tests/projects/c++/modules/class/src/hello_impl.cpp @@ -5,10 +5,9 @@ module hello; using namespace std; namespace hello { - say::say(int data) : data_(data) { - - } - void say::hello() { - cout << "hello, say class: " << data_ << endl; - } +say::say(int data) : data_(data) { +} +void say::hello() { + cout << "hello, say class: " << data_ << endl; } +} // namespace hello diff --git a/tests/projects/c++/modules/class_cmake/src/hello_impl.cpp b/tests/projects/c++/modules/class_cmake/src/hello_impl.cpp index 5dd555a7a..b09f4b96c 100644 --- a/tests/projects/c++/modules/class_cmake/src/hello_impl.cpp +++ b/tests/projects/c++/modules/class_cmake/src/hello_impl.cpp @@ -5,10 +5,9 @@ module hello; using namespace std; namespace hello { - say::say(int data) : data_(data) { - - } - void say::hello() { - cout << "hello, say class: " << data_ << endl; - } +say::say(int data) : data_(data) { +} +void say::hello() { + cout << "hello, say class: " << data_ << endl; } +} // namespace hello diff --git a/tests/projects/c++/modules/class_cmake/src/main.cpp b/tests/projects/c++/modules/class_cmake/src/main.cpp index b96807bda..87b8b92f7 100644 --- a/tests/projects/c++/modules/class_cmake/src/main.cpp +++ b/tests/projects/c++/modules/class_cmake/src/main.cpp @@ -1,7 +1,7 @@ import hello; int main() { - hello::say s(sizeof(hello::say)); - s.hello(); - return 0; + hello::say s(sizeof(hello::say)); + s.hello(); + return 0; } diff --git a/tests/projects/c++/modules/dependence/src/hello_impl.cpp b/tests/projects/c++/modules/dependence/src/hello_impl.cpp index 064afebad..b7f9baaa3 100644 --- a/tests/projects/c++/modules/dependence/src/hello_impl.cpp +++ b/tests/projects/c++/modules/dependence/src/hello_impl.cpp @@ -5,19 +5,20 @@ module hello; import mod; void inner() { - std::cout << "hello world! data: " - << mod::foo() << std::endl; + std::cout << "hello world! data: " << mod::foo() << std::endl; } namespace hello { - int data__; - void say_hello() { ::inner(); } +int data__; +void say_hello() { + ::inner(); +} - say::say(int data) : data_{data} { - } +say::say(int data) : data_{ data } { +} - void say::hello() { - hello::data__ = data_; - ::inner(); - } +void say::hello() { + hello::data__ = data_; + ::inner(); } +} // namespace hello diff --git a/tests/projects/c++/modules/dependence/src/main.cpp b/tests/projects/c++/modules/dependence/src/main.cpp index 93cc427a4..470c69ebc 100644 --- a/tests/projects/c++/modules/dependence/src/main.cpp +++ b/tests/projects/c++/modules/dependence/src/main.cpp @@ -6,4 +6,3 @@ int main() { hello::say(sizeof(hello::say)).hello(); return 0; } - diff --git a/tests/projects/c++/modules/dependence/src/mod_impl.cpp b/tests/projects/c++/modules/dependence/src/mod_impl.cpp index 1adf6570e..aabac7648 100644 --- a/tests/projects/c++/modules/dependence/src/mod_impl.cpp +++ b/tests/projects/c++/modules/dependence/src/mod_impl.cpp @@ -2,7 +2,7 @@ module mod; import hello; namespace mod { - int foo() { - return hello::data__; - } +int foo() { + return hello::data__; } +} // namespace mod diff --git a/tests/projects/c++/modules/dependence2/src/main.cpp b/tests/projects/c++/modules/dependence2/src/main.cpp index b5c04f1b2..a74024e11 100644 --- a/tests/projects/c++/modules/dependence2/src/main.cpp +++ b/tests/projects/c++/modules/dependence2/src/main.cpp @@ -7,4 +7,3 @@ int main() { printf("sub(1, 2): %d\n", foo::sub(1, 2)); return 0; } - diff --git a/tests/projects/c++/modules/dependency_flag_update2/src/main.cpp b/tests/projects/c++/modules/dependency_flag_update2/src/main.cpp index d34cba080..8629450ac 100644 --- a/tests/projects/c++/modules/dependency_flag_update2/src/main.cpp +++ b/tests/projects/c++/modules/dependency_flag_update2/src/main.cpp @@ -1,6 +1,6 @@ import foobar; int main() { - hello(); - return 0; + hello(); + return 0; } diff --git a/tests/projects/c++/modules/headerunits_person/src/test.cpp b/tests/projects/c++/modules/headerunits_person/src/test.cpp index d12206ef7..17a7fb34d 100644 --- a/tests/projects/c++/modules/headerunits_person/src/test.cpp +++ b/tests/projects/c++/modules/headerunits_person/src/test.cpp @@ -1,11 +1,10 @@ import person;
import <iostream>;
-import <string>; // For operator<< for std::string
+import <string>; // For operator<< for std::string
using namespace std;
-int main()
-{
+int main() {
Person person{ "Kole", "Webb" };
cout << person.getLastName() << ", " << person.getFirstName() << endl;
}
diff --git a/tests/projects/c++/modules/hide_dependency_flags/src/main.cpp b/tests/projects/c++/modules/hide_dependency_flags/src/main.cpp index 1d385dcfa..a3447b492 100644 --- a/tests/projects/c++/modules/hide_dependency_flags/src/main.cpp +++ b/tests/projects/c++/modules/hide_dependency_flags/src/main.cpp @@ -2,9 +2,8 @@ import foo; -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("add(1, 2): %d\n", foo::add(1, 2)); printf("sub(1, 2): %d\n", foo::sub(1, 2)); return 0; } - diff --git a/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp index eccfed5d3..fa17673ab 100644 --- a/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp +++ b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp @@ -5,15 +5,15 @@ module hello; using namespace std; namespace hello { - void say_hi() { - cout << "hello hi!" << endl; - } +void say_hi() { + cout << "hello hi!" << endl; +} - void say_hello() { - cout << "hello world!" << endl; - } +void say_hello() { + cout << "hello world!" << endl; +} - void say_xz() { - cout << "hello xz!" << endl; - } +void say_xz() { + cout << "hello xz!" << endl; } +} // namespace hello diff --git a/tests/projects/c++/modules/moduleonly_private_dep/src/main.cpp b/tests/projects/c++/modules/moduleonly_private_dep/src/main.cpp index 0fdfc6d11..1ad0c5d8e 100644 --- a/tests/projects/c++/modules/moduleonly_private_dep/src/main.cpp +++ b/tests/projects/c++/modules/moduleonly_private_dep/src/main.cpp @@ -1,5 +1,5 @@ import B; int main() { - return func(); + return func(); } diff --git a/tests/projects/c++/modules/moduleonly_private_dep/src/modB.cpp b/tests/projects/c++/modules/moduleonly_private_dep/src/modB.cpp index 6e7a8de49..fb3c7a97a 100644 --- a/tests/projects/c++/modules/moduleonly_private_dep/src/modB.cpp +++ b/tests/projects/c++/modules/moduleonly_private_dep/src/modB.cpp @@ -3,5 +3,5 @@ module B; import A; int func() { - return foo; + return foo; } diff --git a/tests/projects/c++/modules/namespace/src/hello_impl.cpp b/tests/projects/c++/modules/namespace/src/hello_impl.cpp index 064afebad..b7f9baaa3 100644 --- a/tests/projects/c++/modules/namespace/src/hello_impl.cpp +++ b/tests/projects/c++/modules/namespace/src/hello_impl.cpp @@ -5,19 +5,20 @@ module hello; import mod; void inner() { - std::cout << "hello world! data: " - << mod::foo() << std::endl; + std::cout << "hello world! data: " << mod::foo() << std::endl; } namespace hello { - int data__; - void say_hello() { ::inner(); } +int data__; +void say_hello() { + ::inner(); +} - say::say(int data) : data_{data} { - } +say::say(int data) : data_{ data } { +} - void say::hello() { - hello::data__ = data_; - ::inner(); - } +void say::hello() { + hello::data__ = data_; + ::inner(); } +} // namespace hello diff --git a/tests/projects/c++/modules/namespace/src/main.cpp b/tests/projects/c++/modules/namespace/src/main.cpp index 93cc427a4..470c69ebc 100644 --- a/tests/projects/c++/modules/namespace/src/main.cpp +++ b/tests/projects/c++/modules/namespace/src/main.cpp @@ -6,4 +6,3 @@ int main() { hello::say(sizeof(hello::say)).hello(); return 0; } - diff --git a/tests/projects/c++/modules/namespace/src/mod_impl.cpp b/tests/projects/c++/modules/namespace/src/mod_impl.cpp index 1adf6570e..aabac7648 100644 --- a/tests/projects/c++/modules/namespace/src/mod_impl.cpp +++ b/tests/projects/c++/modules/namespace/src/mod_impl.cpp @@ -2,7 +2,7 @@ module mod; import hello; namespace mod { - int foo() { - return hello::data__; - } +int foo() { + return hello::data__; } +} // namespace mod diff --git a/tests/projects/c++/modules/namespace2/src/hello_impl.cpp b/tests/projects/c++/modules/namespace2/src/hello_impl.cpp index 064afebad..b7f9baaa3 100644 --- a/tests/projects/c++/modules/namespace2/src/hello_impl.cpp +++ b/tests/projects/c++/modules/namespace2/src/hello_impl.cpp @@ -5,19 +5,20 @@ module hello; import mod; void inner() { - std::cout << "hello world! data: " - << mod::foo() << std::endl; + std::cout << "hello world! data: " << mod::foo() << std::endl; } namespace hello { - int data__; - void say_hello() { ::inner(); } +int data__; +void say_hello() { + ::inner(); +} - say::say(int data) : data_{data} { - } +say::say(int data) : data_{ data } { +} - void say::hello() { - hello::data__ = data_; - ::inner(); - } +void say::hello() { + hello::data__ = data_; + ::inner(); } +} // namespace hello diff --git a/tests/projects/c++/modules/namespace2/src/main.cpp b/tests/projects/c++/modules/namespace2/src/main.cpp index 93cc427a4..470c69ebc 100644 --- a/tests/projects/c++/modules/namespace2/src/main.cpp +++ b/tests/projects/c++/modules/namespace2/src/main.cpp @@ -6,4 +6,3 @@ int main() { hello::say(sizeof(hello::say)).hello(); return 0; } - diff --git a/tests/projects/c++/modules/namespace2/src/mod_impl.cpp b/tests/projects/c++/modules/namespace2/src/mod_impl.cpp index 1adf6570e..aabac7648 100644 --- a/tests/projects/c++/modules/namespace2/src/mod_impl.cpp +++ b/tests/projects/c++/modules/namespace2/src/mod_impl.cpp @@ -2,7 +2,7 @@ module mod; import hello; namespace mod { - int foo() { - return hello::data__; - } +int foo() { + return hello::data__; } +} // namespace mod diff --git a/tests/projects/c++/modules/packages-subtarget/my-repo/packages/f/foo/src/foo.cpp b/tests/projects/c++/modules/packages-subtarget/my-repo/packages/f/foo/src/foo.cpp index e5565a01a..22b4cec59 100644 --- a/tests/projects/c++/modules/packages-subtarget/my-repo/packages/f/foo/src/foo.cpp +++ b/tests/projects/c++/modules/packages-subtarget/my-repo/packages/f/foo/src/foo.cpp @@ -1,6 +1,6 @@ module foo; namespace foo { - void say(const char *msg) { - } +void say(const char *msg) { } +} // namespace foo diff --git a/tests/projects/c++/modules/packages/my-repo/packages/f/foo/src/foo.cpp b/tests/projects/c++/modules/packages/my-repo/packages/f/foo/src/foo.cpp index e5565a01a..22b4cec59 100644 --- a/tests/projects/c++/modules/packages/my-repo/packages/f/foo/src/foo.cpp +++ b/tests/projects/c++/modules/packages/my-repo/packages/f/foo/src/foo.cpp @@ -1,6 +1,6 @@ module foo; namespace foo { - void say(const char *msg) { - } +void say(const char *msg) { } +} // namespace foo diff --git a/tests/projects/c++/modules/partitions/src/main.cpp b/tests/projects/c++/modules/partitions/src/main.cpp index 058dfd522..898d28058 100644 --- a/tests/projects/c++/modules/partitions/src/main.cpp +++ b/tests/projects/c++/modules/partitions/src/main.cpp @@ -3,7 +3,6 @@ import math; int main() { - std::cout << std::endl; std::cout << "add(3, 4): " << add(3, 4) << std::endl; diff --git a/tests/projects/c++/modules/partitions_implunit/src/foo.cpp b/tests/projects/c++/modules/partitions_implunit/src/foo.cpp index cc4c0c3fe..85fcc3b63 100644 --- a/tests/projects/c++/modules/partitions_implunit/src/foo.cpp +++ b/tests/projects/c++/modules/partitions_implunit/src/foo.cpp @@ -3,4 +3,6 @@ module Foo; // Impl is implictly imported here
-void foo() { bar(); }
+void foo() {
+ bar();
+}
diff --git a/tests/projects/c++/modules/partitions_implunit/src/main.cpp b/tests/projects/c++/modules/partitions_implunit/src/main.cpp index acef780c2..9d38b891e 100644 --- a/tests/projects/c++/modules/partitions_implunit/src/main.cpp +++ b/tests/projects/c++/modules/partitions_implunit/src/main.cpp @@ -1,6 +1,6 @@ import Foo;
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
foo();
return 0;
}
diff --git a/tests/projects/c++/modules/partitions_implunit2/src/main.cpp b/tests/projects/c++/modules/partitions_implunit2/src/main.cpp index acef780c2..9d38b891e 100644 --- a/tests/projects/c++/modules/partitions_implunit2/src/main.cpp +++ b/tests/projects/c++/modules/partitions_implunit2/src/main.cpp @@ -1,6 +1,6 @@ import Foo;
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
foo();
return 0;
}
diff --git a/tests/projects/c++/modules/phony/src/hello.cpp b/tests/projects/c++/modules/phony/src/hello.cpp index 38ecf20e3..fe5943e3c 100644 --- a/tests/projects/c++/modules/phony/src/hello.cpp +++ b/tests/projects/c++/modules/phony/src/hello.cpp @@ -7,11 +7,10 @@ module hello; using namespace std; namespace hello { - say::say(int data) : data_(data) { - - } +say::say(int data) : data_(data) { +} - void say::hello() { - cout << "hello, say class: " << data_ << endl; - } +void say::hello() { + cout << "hello, say class: " << data_ << endl; +} } // namespace hello diff --git a/tests/projects/c++/modules/phony2/include/foo.h b/tests/projects/c++/modules/phony2/include/foo.h index e66099202..025d24b7c 100644 --- a/tests/projects/c++/modules/phony2/include/foo.h +++ b/tests/projects/c++/modules/phony2/include/foo.h @@ -1 +1,3 @@ -inline int foo() { return 5; } +inline int foo() { + return 5; +} diff --git a/tests/projects/c++/modules/phony2/src/hello.cpp b/tests/projects/c++/modules/phony2/src/hello.cpp index 38ecf20e3..fe5943e3c 100644 --- a/tests/projects/c++/modules/phony2/src/hello.cpp +++ b/tests/projects/c++/modules/phony2/src/hello.cpp @@ -7,11 +7,10 @@ module hello; using namespace std; namespace hello { - say::say(int data) : data_(data) { - - } +say::say(int data) : data_(data) { +} - void say::hello() { - cout << "hello, say class: " << data_ << endl; - } +void say::hello() { + cout << "hello, say class: " << data_ << endl; +} } // namespace hello diff --git a/tests/projects/c++/modules/staticlib/src/main.cpp b/tests/projects/c++/modules/staticlib/src/main.cpp index af2c328eb..ea199d05c 100644 --- a/tests/projects/c++/modules/staticlib/src/main.cpp +++ b/tests/projects/c++/modules/staticlib/src/main.cpp @@ -5,4 +5,3 @@ int main() { printf("%d\n", mod::foo()); return 0; } - diff --git a/tests/projects/c++/modules/staticlib/src/mod.cpp b/tests/projects/c++/modules/staticlib/src/mod.cpp index 9c7cf5290..34e0d0872 100644 --- a/tests/projects/c++/modules/staticlib/src/mod.cpp +++ b/tests/projects/c++/modules/staticlib/src/mod.cpp @@ -1,7 +1,7 @@ module mod; namespace mod { - int foo() { - return 2; - } +int foo() { + return 2; } +} // namespace mod diff --git a/tests/projects/c++/modules/staticlib2/src/bar.cpp b/tests/projects/c++/modules/staticlib2/src/bar.cpp index 0b5385096..4d62c82be 100644 --- a/tests/projects/c++/modules/staticlib2/src/bar.cpp +++ b/tests/projects/c++/modules/staticlib2/src/bar.cpp @@ -1,8 +1,7 @@ module bar; namespace bar { - int hello() { - return 2; - } +int hello() { + return 2; } - +} // namespace bar diff --git a/tests/projects/c++/modules/staticlib2/src/foo.cpp b/tests/projects/c++/modules/staticlib2/src/foo.cpp index 254371283..a72dfe3ca 100644 --- a/tests/projects/c++/modules/staticlib2/src/foo.cpp +++ b/tests/projects/c++/modules/staticlib2/src/foo.cpp @@ -3,8 +3,7 @@ module foo; import bar; namespace foo { - int hello() { - return bar::hello(); - } +int hello() { + return bar::hello(); } - +} // namespace foo diff --git a/tests/projects/c++/modules/staticlib2/src/main.cpp b/tests/projects/c++/modules/staticlib2/src/main.cpp index 69e91b126..0c8bebf35 100644 --- a/tests/projects/c++/modules/staticlib2/src/main.cpp +++ b/tests/projects/c++/modules/staticlib2/src/main.cpp @@ -5,4 +5,3 @@ int main() { printf("%d\n", foo::hello()); return 0; } - diff --git a/tests/projects/c++/modules/stdmodules/src/my_module.cpp b/tests/projects/c++/modules/stdmodules/src/my_module.cpp index ab3119785..786ae3a9d 100644 --- a/tests/projects/c++/modules/stdmodules/src/my_module.cpp +++ b/tests/projects/c++/modules/stdmodules/src/my_module.cpp @@ -2,4 +2,6 @@ module my_module; import std; -auto my_sum(std::size_t a, std::size_t b) -> std::size_t { return a + b; } +auto my_sum(std::size_t a, std::size_t b) -> std::size_t { + return a + b; +} diff --git a/tests/projects/c++/modules/stdmodules/test/test.cpp b/tests/projects/c++/modules/stdmodules/test/test.cpp index 7c6f7b4df..960b9c3f6 100644 --- a/tests/projects/c++/modules/stdmodules/test/test.cpp +++ b/tests/projects/c++/modules/stdmodules/test/test.cpp @@ -4,6 +4,6 @@ import my_module; using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << my_sum(1, 1) << endl; } diff --git a/tests/projects/c++/modules/stdmodules_cpp_only/src/main.cpp b/tests/projects/c++/modules/stdmodules_cpp_only/src/main.cpp index 477d7c742..b4a8e6c26 100644 --- a/tests/projects/c++/modules/stdmodules_cpp_only/src/main.cpp +++ b/tests/projects/c++/modules/stdmodules_cpp_only/src/main.cpp @@ -2,8 +2,7 @@ import std; using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/modules/stdmodules_deps/src/foo.cpp b/tests/projects/c++/modules/stdmodules_deps/src/foo.cpp index c1e34dec6..59fd74153 100644 --- a/tests/projects/c++/modules/stdmodules_deps/src/foo.cpp +++ b/tests/projects/c++/modules/stdmodules_deps/src/foo.cpp @@ -1,3 +1,5 @@ module foo; -auto my_sum(std::size_t a, std::size_t b) -> std::size_t { return a + b; } +auto my_sum(std::size_t a, std::size_t b) -> std::size_t { + return a + b; +} diff --git a/tests/projects/c++/modules/stdmodules_deps/src/main.cpp b/tests/projects/c++/modules/stdmodules_deps/src/main.cpp index e40a369fa..5806de710 100644 --- a/tests/projects/c++/modules/stdmodules_deps/src/main.cpp +++ b/tests/projects/c++/modules/stdmodules_deps/src/main.cpp @@ -4,6 +4,6 @@ import bar; import std; int main() { - std::cout << my_sum(1, 2) << ":" << my_sum2(1, 2) << std::endl; - return 0; + std::cout << my_sum(1, 2) << ":" << my_sum2(1, 2) << std::endl; + return 0; } diff --git a/tests/projects/c++/modules/stdmodules_multiple_targets/src/my_module.cpp b/tests/projects/c++/modules/stdmodules_multiple_targets/src/my_module.cpp index ab3119785..786ae3a9d 100644 --- a/tests/projects/c++/modules/stdmodules_multiple_targets/src/my_module.cpp +++ b/tests/projects/c++/modules/stdmodules_multiple_targets/src/my_module.cpp @@ -2,4 +2,6 @@ module my_module; import std; -auto my_sum(std::size_t a, std::size_t b) -> std::size_t { return a + b; } +auto my_sum(std::size_t a, std::size_t b) -> std::size_t { + return a + b; +} diff --git a/tests/projects/c++/modules/submodules/src/main.cpp b/tests/projects/c++/modules/submodules/src/main.cpp index 5ff18701f..2ba0a3212 100644 --- a/tests/projects/c++/modules/submodules/src/main.cpp +++ b/tests/projects/c++/modules/submodules/src/main.cpp @@ -2,7 +2,6 @@ import math; int main() { - std::cout << std::endl; std::cout << "add(3, 4): " << add(3, 4) << std::endl; diff --git a/tests/projects/c++/modules/submodules2/src/main.cpp b/tests/projects/c++/modules/submodules2/src/main.cpp index ae58a08a3..db98c4d81 100644 --- a/tests/projects/c++/modules/submodules2/src/main.cpp +++ b/tests/projects/c++/modules/submodules2/src/main.cpp @@ -1,6 +1,6 @@ import main_module; -int main(int argc, char** argv) { +int main(int argc, char **argv) { hello(); return 0; } diff --git a/tests/projects/c++/modules/submodules2/src/module2.cpp b/tests/projects/c++/modules/submodules2/src/module2.cpp index 6ce9f9da9..09e195d39 100644 --- a/tests/projects/c++/modules/submodules2/src/module2.cpp +++ b/tests/projects/c++/modules/submodules2/src/module2.cpp @@ -6,4 +6,3 @@ module main_module.module2; void hello2(void) { printf("hello2\n"); } - diff --git a/tests/projects/c++/modules/xmake_tests1/src/main.cpp b/tests/projects/c++/modules/xmake_tests1/src/main.cpp index 7a7488a3b..a7fb45f9e 100644 --- a/tests/projects/c++/modules/xmake_tests1/src/main.cpp +++ b/tests/projects/c++/modules/xmake_tests1/src/main.cpp @@ -1,3 +1,5 @@ import Foo; -int main() { return foo(); } +int main() { + return foo(); +} diff --git a/tests/projects/c++/modules/xmake_tests2/src/main.cpp b/tests/projects/c++/modules/xmake_tests2/src/main.cpp index 7a7488a3b..a7fb45f9e 100644 --- a/tests/projects/c++/modules/xmake_tests2/src/main.cpp +++ b/tests/projects/c++/modules/xmake_tests2/src/main.cpp @@ -1,3 +1,5 @@ import Foo; -int main() { return foo(); } +int main() { + return foo(); +} diff --git a/tests/projects/c++/precompiled_header/src/header.h b/tests/projects/c++/precompiled_header/src/header.h index affda55ca..910e73544 100644 --- a/tests/projects/c++/precompiled_header/src/header.h +++ b/tests/projects/c++/precompiled_header/src/header.h @@ -1,7 +1,7 @@ // header.h #ifndef HEADER_H #define HEADER_H - + #include <algorithm> #include <deque> #include <iostream> @@ -24,4 +24,3 @@ #include <iomanip> #endif - diff --git a/tests/projects/c++/precompiled_header/src/main.cpp b/tests/projects/c++/precompiled_header/src/main.cpp index 27d41ee50..bfce631e2 100644 --- a/tests/projects/c++/precompiled_header/src/main.cpp +++ b/tests/projects/c++/precompiled_header/src/main.cpp @@ -1,7 +1,6 @@ #include "header.h" -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { std::string s("xmake"); printf("hello %s!\n", s.c_str()); return 0; diff --git a/tests/projects/c++/precompiled_header/src/test.c b/tests/projects/c++/precompiled_header/src/test.c index 7f0aa2bf4..6b15d3d8a 100644 --- a/tests/projects/c++/precompiled_header/src/test.c +++ b/tests/projects/c++/precompiled_header/src/test.c @@ -1,4 +1,3 @@ -void test_c(void) -{ +void test_c(void) { } diff --git a/tests/projects/c++/precompiled_header/src/test.cpp b/tests/projects/c++/precompiled_header/src/test.cpp index e9d6c83d9..4a526251e 100644 --- a/tests/projects/c++/precompiled_header/src/test.cpp +++ b/tests/projects/c++/precompiled_header/src/test.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test() -{ +int test() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test2.cpp b/tests/projects/c++/precompiled_header/src/test2.cpp index 596359cd2..0d9d9240f 100644 --- a/tests/projects/c++/precompiled_header/src/test2.cpp +++ b/tests/projects/c++/precompiled_header/src/test2.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test2() -{ +int test2() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test4.cpp b/tests/projects/c++/precompiled_header/src/test4.cpp index a92803eb7..ebcbe51e0 100644 --- a/tests/projects/c++/precompiled_header/src/test4.cpp +++ b/tests/projects/c++/precompiled_header/src/test4.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test4() -{ +int test4() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test5.cpp b/tests/projects/c++/precompiled_header/src/test5.cpp index 2a3e7066c..c2193ac84 100644 --- a/tests/projects/c++/precompiled_header/src/test5.cpp +++ b/tests/projects/c++/precompiled_header/src/test5.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test5() -{ +int test5() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test6.cpp b/tests/projects/c++/precompiled_header/src/test6.cpp index efbd7c6c1..03dd19a28 100644 --- a/tests/projects/c++/precompiled_header/src/test6.cpp +++ b/tests/projects/c++/precompiled_header/src/test6.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test6() -{ +int test6() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test7.cpp b/tests/projects/c++/precompiled_header/src/test7.cpp index 24aeff619..d0e0e9445 100644 --- a/tests/projects/c++/precompiled_header/src/test7.cpp +++ b/tests/projects/c++/precompiled_header/src/test7.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test7() -{ +int test7() { return 0; } diff --git a/tests/projects/c++/precompiled_header/src/test8.cpp b/tests/projects/c++/precompiled_header/src/test8.cpp index 6ad5680a6..048f2952d 100644 --- a/tests/projects/c++/precompiled_header/src/test8.cpp +++ b/tests/projects/c++/precompiled_header/src/test8.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test8() -{ +int test8() { return 0; } diff --git a/tests/projects/c++/precompiled_header/test3.cpp b/tests/projects/c++/precompiled_header/test3.cpp index 7daf91dd7..c914e1dff 100644 --- a/tests/projects/c++/precompiled_header/test3.cpp +++ b/tests/projects/c++/precompiled_header/test3.cpp @@ -2,7 +2,6 @@ #include "src/header.h" #include "src/header2.h" -int test3() -{ +int test3() { return 0; } diff --git a/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp index dc06458ae..03ede9550 100644 --- a/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp +++ b/tests/projects/c++/protobuf_grpc_cpp_plugin/src/main.cpp @@ -4,8 +4,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << "hello world!" << endl; return 0; } diff --git a/tests/projects/c++/shared_library/src/foo.h b/tests/projects/c++/shared_library/src/foo.h index 20df0baa4..bd496c784 100644 --- a/tests/projects/c++/shared_library/src/foo.h +++ b/tests/projects/c++/shared_library/src/foo.h @@ -3,11 +3,11 @@ extern "C" { #endif #if defined(_WIN32) -# define __export __declspec(dllexport) +#define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define __export __attribute__((visibility("default"))) +#define __export __attribute__((visibility("default"))) #else -# define __export +#define __export #endif __export int add(int a, int b); diff --git a/tests/projects/c++/shared_library/src/main.cpp b/tests/projects/c++/shared_library/src/main.cpp index ed1924789..41e494481 100644 --- a/tests/projects/c++/shared_library/src/main.cpp +++ b/tests/projects/c++/shared_library/src/main.cpp @@ -3,7 +3,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; } diff --git a/tests/projects/c++/shared_library_export_all/src/bar.h b/tests/projects/c++/shared_library_export_all/src/bar.h index 687386e0a..5abca5a30 100644 --- a/tests/projects/c++/shared_library_export_all/src/bar.h +++ b/tests/projects/c++/shared_library_export_all/src/bar.h @@ -1,4 +1,4 @@ class bar { -public: + public: static int add(int a, int b); }; diff --git a/tests/projects/c++/shared_library_export_all/src/foo.h b/tests/projects/c++/shared_library_export_all/src/foo.h index e27636b94..9ec469d23 100644 --- a/tests/projects/c++/shared_library_export_all/src/foo.h +++ b/tests/projects/c++/shared_library_export_all/src/foo.h @@ -1,4 +1,4 @@ class foo { -public: + public: static int add(int a, int b); }; diff --git a/tests/projects/c++/shared_library_export_all/src/main.cpp b/tests/projects/c++/shared_library_export_all/src/main.cpp index cc95897ee..d731d7590 100644 --- a/tests/projects/c++/shared_library_export_all/src/main.cpp +++ b/tests/projects/c++/shared_library_export_all/src/main.cpp @@ -2,7 +2,7 @@ #include "bar.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "foo::add(1, 2) = " << foo::add(1, 2) << std::endl; std::cout << "bar::add(1, 2) = " << bar::add(1, 2) << std::endl; return 0; diff --git a/tests/projects/c++/shared_library_with_soname/src/foo.h b/tests/projects/c++/shared_library_with_soname/src/foo.h index 20df0baa4..bd496c784 100644 --- a/tests/projects/c++/shared_library_with_soname/src/foo.h +++ b/tests/projects/c++/shared_library_with_soname/src/foo.h @@ -3,11 +3,11 @@ extern "C" { #endif #if defined(_WIN32) -# define __export __declspec(dllexport) +#define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define __export __attribute__((visibility("default"))) +#define __export __attribute__((visibility("default"))) #else -# define __export +#define __export #endif __export int add(int a, int b); diff --git a/tests/projects/c++/shared_library_with_soname/src/main.cpp b/tests/projects/c++/shared_library_with_soname/src/main.cpp index ed1924789..41e494481 100644 --- a/tests/projects/c++/shared_library_with_soname/src/main.cpp +++ b/tests/projects/c++/shared_library_with_soname/src/main.cpp @@ -3,7 +3,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; } diff --git a/tests/projects/c++/static_library/src/main.cpp b/tests/projects/c++/static_library/src/main.cpp index ed1924789..41e494481 100644 --- a/tests/projects/c++/static_library/src/main.cpp +++ b/tests/projects/c++/static_library/src/main.cpp @@ -3,7 +3,7 @@ using namespace std; -int main(int argc, char** argv) { +int main(int argc, char **argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; } diff --git a/tests/projects/c++/test(brackets)/src/main.cpp b/tests/projects/c++/test(brackets)/src/main.cpp index a20aef120..134c3d51a 100644 --- a/tests/projects/c++/test(brackets)/src/main.cpp +++ b/tests/projects/c++/test(brackets)/src/main.cpp @@ -3,8 +3,7 @@ using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { cout << TEST " " WORD "!" << endl; return 0; } diff --git a/tests/projects/c++/unity_build/src/bar/test4.cpp b/tests/projects/c++/unity_build/src/bar/test4.cpp index 8fe732964..5012c2235 100644 --- a/tests/projects/c++/unity_build/src/bar/test4.cpp +++ b/tests/projects/c++/unity_build/src/bar/test4.cpp @@ -3,10 +3,9 @@ #include "header.h" namespace MY_UNITY_ID { - int i = 42; +int i = 42; } -int test4() -{ +int test4() { return MY_UNITY_ID::i; } diff --git a/tests/projects/c++/unity_build/src/bar/test5.cpp b/tests/projects/c++/unity_build/src/bar/test5.cpp index afff0b46c..80beed9a4 100644 --- a/tests/projects/c++/unity_build/src/bar/test5.cpp +++ b/tests/projects/c++/unity_build/src/bar/test5.cpp @@ -3,11 +3,9 @@ #include "header.h" namespace MY_UNITY_ID { - int i = 42; +int i = 42; } -int test5() -{ +int test5() { return MY_UNITY_ID::i; } - diff --git a/tests/projects/c++/unity_build/src/bar/test6.cpp b/tests/projects/c++/unity_build/src/bar/test6.cpp index efbd7c6c1..03dd19a28 100644 --- a/tests/projects/c++/unity_build/src/bar/test6.cpp +++ b/tests/projects/c++/unity_build/src/bar/test6.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test6() -{ +int test6() { return 0; } diff --git a/tests/projects/c++/unity_build/src/foo/test.cpp b/tests/projects/c++/unity_build/src/foo/test.cpp index e9d6c83d9..4a526251e 100644 --- a/tests/projects/c++/unity_build/src/foo/test.cpp +++ b/tests/projects/c++/unity_build/src/foo/test.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test() -{ +int test() { return 0; } diff --git a/tests/projects/c++/unity_build/src/foo/test2.cpp b/tests/projects/c++/unity_build/src/foo/test2.cpp index 596359cd2..0d9d9240f 100644 --- a/tests/projects/c++/unity_build/src/foo/test2.cpp +++ b/tests/projects/c++/unity_build/src/foo/test2.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test2() -{ +int test2() { return 0; } diff --git a/tests/projects/c++/unity_build/src/header.h b/tests/projects/c++/unity_build/src/header.h index affda55ca..910e73544 100644 --- a/tests/projects/c++/unity_build/src/header.h +++ b/tests/projects/c++/unity_build/src/header.h @@ -1,7 +1,7 @@ // header.h #ifndef HEADER_H #define HEADER_H - + #include <algorithm> #include <deque> #include <iostream> @@ -24,4 +24,3 @@ #include <iomanip> #endif - diff --git a/tests/projects/c++/unity_build/src/main.cpp b/tests/projects/c++/unity_build/src/main.cpp index 27d41ee50..bfce631e2 100644 --- a/tests/projects/c++/unity_build/src/main.cpp +++ b/tests/projects/c++/unity_build/src/main.cpp @@ -1,7 +1,6 @@ #include "header.h" -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { std::string s("xmake"); printf("hello %s!\n", s.c_str()); return 0; diff --git a/tests/projects/c++/unity_build/src/test.c b/tests/projects/c++/unity_build/src/test.c index 7f0aa2bf4..6b15d3d8a 100644 --- a/tests/projects/c++/unity_build/src/test.c +++ b/tests/projects/c++/unity_build/src/test.c @@ -1,4 +1,3 @@ -void test_c(void) -{ +void test_c(void) { } diff --git a/tests/projects/c++/unity_build/src/test7.cpp b/tests/projects/c++/unity_build/src/test7.cpp index 24aeff619..d0e0e9445 100644 --- a/tests/projects/c++/unity_build/src/test7.cpp +++ b/tests/projects/c++/unity_build/src/test7.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test7() -{ +int test7() { return 0; } diff --git a/tests/projects/c++/unity_build/src/test8.cpp b/tests/projects/c++/unity_build/src/test8.cpp index 6ad5680a6..048f2952d 100644 --- a/tests/projects/c++/unity_build/src/test8.cpp +++ b/tests/projects/c++/unity_build/src/test8.cpp @@ -2,7 +2,6 @@ // main.cpp #include "header.h" -int test8() -{ +int test8() { return 0; } diff --git a/tests/projects/pascal/console_with_c/src/foo.c b/tests/projects/pascal/console_with_c/src/foo.c index 66ca7cfb4..0d56f5f09 100644 --- a/tests/projects/pascal/console_with_c/src/foo.c +++ b/tests/projects/pascal/console_with_c/src/foo.c @@ -1,7 +1,5 @@ #include <stdint.h> -extern int64_t fib(int64_t n) -{ +extern int64_t fib(int64_t n) { return n > 1 ? fib(n - 1) + fib(n - 2) : 1; } - diff --git a/xmake/templates/c++/console/project/src/main.cpp b/xmake/templates/c++/console/project/src/main.cpp index 7c775d288..9b6abffea 100644 --- a/xmake/templates/c++/console/project/src/main.cpp +++ b/xmake/templates/c++/console/project/src/main.cpp @@ -1,6 +1,6 @@ #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "hello world!" << std::endl; return 0; } diff --git a/xmake/templates/c++/module.binary/project/modules/binary/bar/src/add.cpp b/xmake/templates/c++/module.binary/project/modules/binary/bar/src/add.cpp index e19d07e12..93fdf0ad8 100644 --- a/xmake/templates/c++/module.binary/project/modules/binary/bar/src/add.cpp +++ b/xmake/templates/c++/module.binary/project/modules/binary/bar/src/add.cpp @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a + b); diff --git a/xmake/templates/c++/module.binary/project/modules/binary/bar/src/sub.cpp b/xmake/templates/c++/module.binary/project/modules/binary/bar/src/sub.cpp index 980289d1a..ae7b6d1f2 100644 --- a/xmake/templates/c++/module.binary/project/modules/binary/bar/src/sub.cpp +++ b/xmake/templates/c++/module.binary/project/modules/binary/bar/src/sub.cpp @@ -1,10 +1,9 @@ #include <stdio.h> #include <stdlib.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a - b); return 0; } - diff --git a/xmake/templates/c++/module.binary/project/src/main.cpp b/xmake/templates/c++/module.binary/project/src/main.cpp index 7c775d288..9b6abffea 100644 --- a/xmake/templates/c++/module.binary/project/src/main.cpp +++ b/xmake/templates/c++/module.binary/project/src/main.cpp @@ -1,6 +1,6 @@ #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "hello world!" << std::endl; return 0; } diff --git a/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp b/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp index a98baca02..adde214ca 100644 --- a/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp +++ b/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp @@ -1,27 +1,22 @@ #include <xmi.h> -static int add(lua_State* lua) { +static int add(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a + b); return 1; } -static int sub(lua_State* lua) { +static int sub(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a - b); return 1; } -int luaopen(foo, lua_State* lua) { - static const luaL_Reg funcs[] = { - {"add", add}, - {"sub", sub}, - {NULL, NULL} - }; +int luaopen(foo, lua_State *lua) { + static const luaL_Reg funcs[] = { { "add", add }, { "sub", sub }, { NULL, NULL } }; lua_newtable(lua); luaL_setfuncs(lua, funcs, 0); return 1; } - diff --git a/xmake/templates/c++/module.shared/project/src/main.cpp b/xmake/templates/c++/module.shared/project/src/main.cpp index 7c775d288..9b6abffea 100644 --- a/xmake/templates/c++/module.shared/project/src/main.cpp +++ b/xmake/templates/c++/module.shared/project/src/main.cpp @@ -1,6 +1,6 @@ #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "hello world!" << std::endl; return 0; } diff --git a/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp b/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp index 2ec4b880c..7d9cb80df 100644 --- a/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp +++ b/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp @@ -1,8 +1,7 @@ #include <QGuiApplication> #include <QQmlApplicationEngine> -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { #if QT_VERSION >= 0x50601 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif diff --git a/xmake/templates/c++/qt.shared/project/src/demo.cpp b/xmake/templates/c++/qt.shared/project/src/demo.cpp index bd791c271..576c861f0 100644 --- a/xmake/templates/c++/qt.shared/project/src/demo.cpp +++ b/xmake/templates/c++/qt.shared/project/src/demo.cpp @@ -1,6 +1,4 @@ #include "demo.h" - -QtDemo::QtDemo() -{ +QtDemo::QtDemo() { } diff --git a/xmake/templates/c++/qt.shared/project/src/demo.h b/xmake/templates/c++/qt.shared/project/src/demo.h index a0c8d28c6..89f29ec46 100644 --- a/xmake/templates/c++/qt.shared/project/src/demo.h +++ b/xmake/templates/c++/qt.shared/project/src/demo.h @@ -3,10 +3,8 @@ #include "demo_global.h" -class QT_DEMOSHARED_EXPORT QtDemo -{ - -public: +class QT_DEMOSHARED_EXPORT QtDemo { + public: QtDemo(); }; diff --git a/xmake/templates/c++/qt.shared/project/src/demo_global.h b/xmake/templates/c++/qt.shared/project/src/demo_global.h index a1daff02a..d6b1ddf0b 100644 --- a/xmake/templates/c++/qt.shared/project/src/demo_global.h +++ b/xmake/templates/c++/qt.shared/project/src/demo_global.h @@ -4,9 +4,9 @@ #include <QtCore/qglobal.h> #if defined(QT_DEMO_LIBRARY) -# define QT_DEMOSHARED_EXPORT Q_DECL_EXPORT +#define QT_DEMOSHARED_EXPORT Q_DECL_EXPORT #else -# define QT_DEMOSHARED_EXPORT Q_DECL_IMPORT +#define QT_DEMOSHARED_EXPORT Q_DECL_IMPORT #endif #endif // QT_DEMO_GLOBAL_H diff --git a/xmake/templates/c++/qt.static/project/src/demo.cpp b/xmake/templates/c++/qt.static/project/src/demo.cpp index a702ad253..576c861f0 100644 --- a/xmake/templates/c++/qt.static/project/src/demo.cpp +++ b/xmake/templates/c++/qt.static/project/src/demo.cpp @@ -1,5 +1,4 @@ #include "demo.h" -QtDemo::QtDemo() -{ +QtDemo::QtDemo() { } diff --git a/xmake/templates/c++/qt.static/project/src/demo.h b/xmake/templates/c++/qt.static/project/src/demo.h index 51eb9be55..24730c9d8 100644 --- a/xmake/templates/c++/qt.static/project/src/demo.h +++ b/xmake/templates/c++/qt.static/project/src/demo.h @@ -1,10 +1,8 @@ #ifndef QT_DEMO_H #define QT_DEMO_H -class QtDemo -{ - -public: +class QtDemo { + public: QtDemo(); }; diff --git a/xmake/templates/c++/qt.widgetapp/project/src/main.cpp b/xmake/templates/c++/qt.widgetapp/project/src/main.cpp index eb4e26c90..191ae18d2 100644 --- a/xmake/templates/c++/qt.widgetapp/project/src/main.cpp +++ b/xmake/templates/c++/qt.widgetapp/project/src/main.cpp @@ -3,7 +3,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - MainWindow w; + MainWindow w; w.show(); return a.exec(); } diff --git a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp index 57ab27f7d..c9c6a0d98 100644 --- a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp +++ b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp @@ -1,9 +1,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), - ui(new Ui::MainWindow) { +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } diff --git a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h index a3948a917..a4245aa42 100644 --- a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h +++ b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h @@ -7,15 +7,14 @@ namespace Ui { class MainWindow; } -class MainWindow : public QMainWindow -{ +class MainWindow : public QMainWindow { Q_OBJECT -public: + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); -private: + private: Ui::MainWindow *ui; }; diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp b/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp index b48f94ec8..db5b0cce8 100644 --- a/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp @@ -1,10 +1,9 @@ #include "mainwindow.h" #include <QApplication> -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { QApplication a(argc, argv); - MainWindow w; + MainWindow w; w.show(); return a.exec(); diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp index 49d64fce7..c9c6a0d98 100644 --- a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp @@ -1,14 +1,10 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } -MainWindow::~MainWindow() -{ +MainWindow::~MainWindow() { delete ui; } diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h index a3948a917..a4245aa42 100644 --- a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h @@ -7,15 +7,14 @@ namespace Ui { class MainWindow; } -class MainWindow : public QMainWindow -{ +class MainWindow : public QMainWindow { Q_OBJECT -public: + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); -private: + private: Ui::MainWindow *ui; }; diff --git a/xmake/templates/c++/shared/project/src/foo.h b/xmake/templates/c++/shared/project/src/foo.h index 20df0baa4..bd496c784 100644 --- a/xmake/templates/c++/shared/project/src/foo.h +++ b/xmake/templates/c++/shared/project/src/foo.h @@ -3,11 +3,11 @@ extern "C" { #endif #if defined(_WIN32) -# define __export __declspec(dllexport) +#define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define __export __attribute__((visibility("default"))) +#define __export __attribute__((visibility("default"))) #else -# define __export +#define __export #endif __export int add(int a, int b); diff --git a/xmake/templates/c++/shared/project/src/main.cpp b/xmake/templates/c++/shared/project/src/main.cpp index d55d4d342..3834ee4d3 100644 --- a/xmake/templates/c++/shared/project/src/main.cpp +++ b/xmake/templates/c++/shared/project/src/main.cpp @@ -1,7 +1,7 @@ #include "foo.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; return 0; } diff --git a/xmake/templates/c++/static/project/src/main.cpp b/xmake/templates/c++/static/project/src/main.cpp index d55d4d342..3834ee4d3 100644 --- a/xmake/templates/c++/static/project/src/main.cpp +++ b/xmake/templates/c++/static/project/src/main.cpp @@ -1,7 +1,7 @@ #include "foo.h" #include <iostream> -int main(int argc, char** argv) { +int main(int argc, char **argv) { std::cout << "add(1, 2) = " << add(1, 2) << std::endl; return 0; } diff --git a/xmake/templates/c++/tbox.console/project/src/main.cpp b/xmake/templates/c++/tbox.console/project/src/main.cpp index 8cad00d22..2c7596b33 100644 --- a/xmake/templates/c++/tbox.console/project/src/main.cpp +++ b/xmake/templates/c++/tbox.console/project/src/main.cpp @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_exit(); diff --git a/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp index 84dad3f2b..b1e763989 100644 --- a/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp +++ b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_trace_i("add(1 + 1) = %d", add(1, 1)); diff --git a/xmake/templates/c++/tbox.shared/project/src/_library/interface.h b/xmake/templates/c++/tbox.shared/project/src/_library/interface.h index 398ad5d04..843ef1c98 100644 --- a/xmake/templates/c++/tbox.shared/project/src/_library/interface.h +++ b/xmake/templates/c++/tbox.shared/project/src/_library/interface.h @@ -11,7 +11,8 @@ */ __tb_extern_c_enter__ -__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); + __tb_export__ tb_int_t + add(tb_int_t a, tb_int_t b); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp index 84dad3f2b..b1e763989 100644 --- a/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp +++ b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_trace_i("add(1 + 1) = %d", add(1, 1)); diff --git a/xmake/templates/c++/tbox.static/project/src/_library/interface.h b/xmake/templates/c++/tbox.static/project/src/_library/interface.h index 33d088314..caddb8394 100644 --- a/xmake/templates/c++/tbox.static/project/src/_library/interface.h +++ b/xmake/templates/c++/tbox.static/project/src/_library/interface.h @@ -11,7 +11,8 @@ */ __tb_extern_c_enter__ -tb_int_t add(tb_int_t a, tb_int_t b); + tb_int_t + add(tb_int_t a, tb_int_t b); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/xmake/templates/c++/wxwidgets/project/src/main.cpp b/xmake/templates/c++/wxwidgets/project/src/main.cpp index fbf187aa9..4b43fe6e3 100644 --- a/xmake/templates/c++/wxwidgets/project/src/main.cpp +++ b/xmake/templates/c++/wxwidgets/project/src/main.cpp @@ -1,44 +1,48 @@ #include <wx/wx.h> namespace Examples { - class Frame : public wxFrame { +class Frame : public wxFrame { enum wxOwnedID { - ID_Hello = 2 + ID_Hello = 2 }; public: - Frame(): wxFrame(nullptr, wxID_ANY, "Hello World") { - auto menuFile = new wxMenu(); - menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item"); - menuFile->AppendSeparator(); - menuFile->Append(wxID_EXIT); + Frame() : wxFrame(nullptr, wxID_ANY, "Hello World") { + auto menuFile = new wxMenu(); + menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item"); + menuFile->AppendSeparator(); + menuFile->Append(wxID_EXIT); - auto menuHelp = new wxMenu(); - menuHelp->Append(wxID_ABOUT); - auto menuBar = new wxMenuBar(); + auto menuHelp = new wxMenu(); + menuHelp->Append(wxID_ABOUT); + auto menuBar = new wxMenuBar(); - menuBar->Append(menuFile, "&File"); - menuBar->Append(menuHelp, "&Help"); - SetMenuBar(menuBar); + menuBar->Append(menuFile, "&File"); + menuBar->Append(menuHelp, "&Help"); + SetMenuBar(menuBar); - CreateStatusBar(); - SetStatusText("Welcome to wxWidgets!"); + CreateStatusBar(); + SetStatusText("Welcome to wxWidgets!"); - menuBar->Bind(wxEVT_MENU, [&](wxCommandEvent& event) { - if (event.GetId() == ID_Hello) wxLogMessage("Hello world from wxWidgets!"); - else if (event.GetId() == wxID_ABOUT) wxMessageBox("This is a wxWidgets Hello World example", "About Hello World", wxOK|wxICON_INFORMATION); - else if (event.GetId() == wxID_EXIT) Close(true); - else event.Skip(); - }); + menuBar->Bind(wxEVT_MENU, [&](wxCommandEvent &event) { + if (event.GetId() == ID_Hello) + wxLogMessage("Hello world from wxWidgets!"); + else if (event.GetId() == wxID_ABOUT) + wxMessageBox("This is a wxWidgets Hello World example", "About Hello World", wxOK | wxICON_INFORMATION); + else if (event.GetId() == wxID_EXIT) + Close(true); + else + event.Skip(); + }); } - }; +}; - class Application : public wxApp { +class Application : public wxApp { bool OnInit() override { - (new Frame())->Show(); - return true; + (new Frame())->Show(); + return true; } - }; -} +}; +} // namespace Examples wxIMPLEMENT_APP(Examples::Application);
\ No newline at end of file diff --git a/xmake/templates/c++/xmake.cli/project/src/lni/main.cpp b/xmake/templates/c++/xmake.cli/project/src/lni/main.cpp index 80237da16..e8955e074 100644 --- a/xmake/templates/c++/xmake.cli/project/src/lni/main.cpp +++ b/xmake/templates/c++/xmake.cli/project/src/lni/main.cpp @@ -3,26 +3,21 @@ extern "C" { } static tb_byte_t const g_luafiles_data[] = { - #include "luafiles.xmz.h" +#include "luafiles.xmz.h" }; -static tb_int_t lni_test_hello(lua_State* lua) { +static tb_int_t lni_test_hello(lua_State *lua) { lua_pushliteral(lua, "hello xmake!"); return 1; } -static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State* lua) { - static luaL_Reg const lni_test_funcs[] = { - {"hello", lni_test_hello} - , {tb_null, tb_null} - }; +static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State *lua) { + static luaL_Reg const lni_test_funcs[] = { { "hello", lni_test_hello }, { tb_null, tb_null } }; xm_engine_register(engine, "test", lni_test_funcs); xm_engine_add_embedfiles(engine, g_luafiles_data, sizeof(g_luafiles_data)); } -tb_int_t main(tb_int_t argc, tb_char_t** argv) { - tb_char_t* taskargv[] = {"lua", "-D", "lua.main", tb_null}; +tb_int_t main(tb_int_t argc, tb_char_t **argv) { + tb_char_t *taskargv[] = { "lua", "-D", "lua.main", tb_null }; return xm_engine_run("${TARGETNAME}", argc, argv, taskargv, lni_initalizer); } - - diff --git a/xmake/templates/c/console/project/src/main.c b/xmake/templates/c/console/project/src/main.c index 113930e1a..ccf4b2a77 100644 --- a/xmake/templates/c/console/project/src/main.c +++ b/xmake/templates/c/console/project/src/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("hello world!\n"); return 0; } diff --git a/xmake/templates/c/module.binary/project/modules/binary/bar/src/add.c b/xmake/templates/c/module.binary/project/modules/binary/bar/src/add.c index e19d07e12..93fdf0ad8 100644 --- a/xmake/templates/c/module.binary/project/modules/binary/bar/src/add.c +++ b/xmake/templates/c/module.binary/project/modules/binary/bar/src/add.c @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a + b); diff --git a/xmake/templates/c/module.binary/project/modules/binary/bar/src/sub.c b/xmake/templates/c/module.binary/project/modules/binary/bar/src/sub.c index 980289d1a..ae7b6d1f2 100644 --- a/xmake/templates/c/module.binary/project/modules/binary/bar/src/sub.c +++ b/xmake/templates/c/module.binary/project/modules/binary/bar/src/sub.c @@ -1,10 +1,9 @@ #include <stdio.h> #include <stdlib.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a - b); return 0; } - diff --git a/xmake/templates/c/module.binary/project/src/main.c b/xmake/templates/c/module.binary/project/src/main.c index 113930e1a..ccf4b2a77 100644 --- a/xmake/templates/c/module.binary/project/src/main.c +++ b/xmake/templates/c/module.binary/project/src/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("hello world!\n"); return 0; } diff --git a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c index a98baca02..adde214ca 100644 --- a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c +++ b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c @@ -1,27 +1,22 @@ #include <xmi.h> -static int add(lua_State* lua) { +static int add(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a + b); return 1; } -static int sub(lua_State* lua) { +static int sub(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a - b); return 1; } -int luaopen(foo, lua_State* lua) { - static const luaL_Reg funcs[] = { - {"add", add}, - {"sub", sub}, - {NULL, NULL} - }; +int luaopen(foo, lua_State *lua) { + static const luaL_Reg funcs[] = { { "add", add }, { "sub", sub }, { NULL, NULL } }; lua_newtable(lua); luaL_setfuncs(lua, funcs, 0); return 1; } - diff --git a/xmake/templates/c/module.shared/project/src/main.c b/xmake/templates/c/module.shared/project/src/main.c index 113930e1a..ccf4b2a77 100644 --- a/xmake/templates/c/module.shared/project/src/main.c +++ b/xmake/templates/c/module.shared/project/src/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("hello world!\n"); return 0; } diff --git a/xmake/templates/c/shared/project/src/foo.h b/xmake/templates/c/shared/project/src/foo.h index b014f28e3..e15925829 100644 --- a/xmake/templates/c/shared/project/src/foo.h +++ b/xmake/templates/c/shared/project/src/foo.h @@ -1,11 +1,9 @@ #if defined(_WIN32) -# define __export __declspec(dllexport) +#define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define __export __attribute__((visibility("default"))) +#define __export __attribute__((visibility("default"))) #else -# define __export +#define __export #endif __export int add(int a, int b); - - diff --git a/xmake/templates/c/shared/project/src/main.c b/xmake/templates/c/shared/project/src/main.c index a4c769408..f1c29d751 100644 --- a/xmake/templates/c/shared/project/src/main.c +++ b/xmake/templates/c/shared/project/src/main.c @@ -1,7 +1,7 @@ #include "foo.h" #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("add(1, 2) = %d\n", add(1, 2)); return 0; } diff --git a/xmake/templates/c/static/project/src/main.c b/xmake/templates/c/static/project/src/main.c index a4c769408..f1c29d751 100644 --- a/xmake/templates/c/static/project/src/main.c +++ b/xmake/templates/c/static/project/src/main.c @@ -1,7 +1,7 @@ #include "foo.h" #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("add(1, 2) = %d\n", add(1, 2)); return 0; } diff --git a/xmake/templates/c/tbox.console/project/src/main.c b/xmake/templates/c/tbox.console/project/src/main.c index 8cad00d22..2c7596b33 100644 --- a/xmake/templates/c/tbox.console/project/src/main.c +++ b/xmake/templates/c/tbox.console/project/src/main.c @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_exit(); diff --git a/xmake/templates/c/tbox.shared/project/src/_demo/main.c b/xmake/templates/c/tbox.shared/project/src/_demo/main.c index 84dad3f2b..b1e763989 100644 --- a/xmake/templates/c/tbox.shared/project/src/_demo/main.c +++ b/xmake/templates/c/tbox.shared/project/src/_demo/main.c @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_trace_i("add(1 + 1) = %d", add(1, 1)); diff --git a/xmake/templates/c/tbox.shared/project/src/_library/interface.h b/xmake/templates/c/tbox.shared/project/src/_library/interface.h index 398ad5d04..843ef1c98 100644 --- a/xmake/templates/c/tbox.shared/project/src/_library/interface.h +++ b/xmake/templates/c/tbox.shared/project/src/_library/interface.h @@ -11,7 +11,8 @@ */ __tb_extern_c_enter__ -__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); + __tb_export__ tb_int_t + add(tb_int_t a, tb_int_t b); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/xmake/templates/c/tbox.static/project/src/_demo/main.c b/xmake/templates/c/tbox.static/project/src/_demo/main.c index 84dad3f2b..b1e763989 100644 --- a/xmake/templates/c/tbox.static/project/src/_demo/main.c +++ b/xmake/templates/c/tbox.static/project/src/_demo/main.c @@ -6,7 +6,7 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * main */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) { +tb_int_t main(tb_int_t argc, tb_char_t **argv) { if (tb_init(tb_null, tb_null)) { tb_trace_i("hello tbox!"); tb_trace_i("add(1 + 1) = %d", add(1, 1)); diff --git a/xmake/templates/c/tbox.static/project/src/_library/interface.c b/xmake/templates/c/tbox.static/project/src/_library/interface.c index a0ccb007b..ab0a826a6 100644 --- a/xmake/templates/c/tbox.static/project/src/_library/interface.c +++ b/xmake/templates/c/tbox.static/project/src/_library/interface.c @@ -6,7 +6,6 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ -tb_int_t add(tb_int_t a, tb_int_t b) -{ +tb_int_t add(tb_int_t a, tb_int_t b) { return a + b; } diff --git a/xmake/templates/c/tbox.static/project/src/_library/interface.h b/xmake/templates/c/tbox.static/project/src/_library/interface.h index 33d088314..caddb8394 100644 --- a/xmake/templates/c/tbox.static/project/src/_library/interface.h +++ b/xmake/templates/c/tbox.static/project/src/_library/interface.h @@ -11,7 +11,8 @@ */ __tb_extern_c_enter__ -tb_int_t add(tb_int_t a, tb_int_t b); + tb_int_t + add(tb_int_t a, tb_int_t b); /* ////////////////////////////////////////////////////////////////////////////////////// * extern diff --git a/xmake/templates/c/xmake.cli/project/src/lni/main.c b/xmake/templates/c/xmake.cli/project/src/lni/main.c index 98a4c19ce..a4c6499ee 100644 --- a/xmake/templates/c/xmake.cli/project/src/lni/main.c +++ b/xmake/templates/c/xmake.cli/project/src/lni/main.c @@ -1,25 +1,21 @@ #include <xmake/xmake.h> static tb_byte_t const g_luafiles_data[] = { - #include "luafiles.xmz.h" +#include "luafiles.xmz.h" }; -static tb_int_t lni_test_hello(lua_State* lua) { +static tb_int_t lni_test_hello(lua_State *lua) { lua_pushliteral(lua, "hello xmake!"); return 1; } -static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State* lua) { - static luaL_Reg const lni_test_funcs[] = { - {"hello", lni_test_hello} - , {tb_null, tb_null} - }; +static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State *lua) { + static luaL_Reg const lni_test_funcs[] = { { "hello", lni_test_hello }, { tb_null, tb_null } }; xm_engine_register(engine, "test", lni_test_funcs); xm_engine_add_embedfiles(engine, g_luafiles_data, sizeof(g_luafiles_data)); } -tb_int_t main(tb_int_t argc, tb_char_t** argv) { - tb_char_t* taskargv[] = {"lua", "-D", "lua.main", tb_null}; +tb_int_t main(tb_int_t argc, tb_char_t **argv) { + tb_char_t *taskargv[] = { "lua", "-D", "lua.main", tb_null }; return xm_engine_run("${TARGETNAME}", argc, argv, taskargv, lni_initalizer); } - diff --git a/xmake/templates/kotlin/shared_library/project/src/main.c b/xmake/templates/kotlin/shared_library/project/src/main.c index 55e16305d..abb3f2c12 100644 --- a/xmake/templates/kotlin/shared_library/project/src/main.c +++ b/xmake/templates/kotlin/shared_library/project/src/main.c @@ -1,7 +1,7 @@ #include "libfoo_api.h" #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("add(1, 2) = %d\n", kotlin_add(1, 2)); return 0; } diff --git a/xmake/templates/kotlin/static_library/project/src/main.c b/xmake/templates/kotlin/static_library/project/src/main.c index 55e16305d..abb3f2c12 100644 --- a/xmake/templates/kotlin/static_library/project/src/main.c +++ b/xmake/templates/kotlin/static_library/project/src/main.c @@ -1,7 +1,7 @@ #include "libfoo_api.h" #include <stdio.h> -int main(int argc, char** argv) { +int main(int argc, char **argv) { printf("add(1, 2) = %d\n", kotlin_add(1, 2)); return 0; } |
