From 1fa10a5ccbf47cdc47d07d6e93cecb25a3d60df7 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 30 Sep 2020 23:33:10 -0700 Subject: [PATCH] cpplint Convert complex multiline /* */ comments to single line comments --- src/kaleidoscope_internal/LEDModeManager.h | 5 +- src/kaleidoscope_internal/event_dispatch.h | 10 +- .../eventhandler_signature_check.h | 88 ++++++------ .../type_traits/has_member.h | 134 +++++++++--------- .../type_traits/has_method.h | 52 +++---- 5 files changed, 144 insertions(+), 145 deletions(-) diff --git a/src/kaleidoscope_internal/LEDModeManager.h b/src/kaleidoscope_internal/LEDModeManager.h index a1277f78..4d614145 100644 --- a/src/kaleidoscope_internal/LEDModeManager.h +++ b/src/kaleidoscope_internal/LEDModeManager.h @@ -338,9 +338,8 @@ class LEDModeManager { 0 /*dummy*/ ) ); - parent_plugin->registerLEDModeActivated(255 /* dymmy to disable access - to transient LED modes through LEDControl */ - ); + // dummy to disable access to transient LED modes through LEDControl + parent_plugin->registerLEDModeActivated(255); return led_mode; } diff --git a/src/kaleidoscope_internal/event_dispatch.h b/src/kaleidoscope_internal/event_dispatch.h index be51e7aa..450933d6 100644 --- a/src/kaleidoscope_internal/event_dispatch.h +++ b/src/kaleidoscope_internal/event_dispatch.h @@ -131,10 +131,10 @@ = HookVersionImplemented_##HOOK_NAME< __NL__ \ Plugin__, HOOK_VERSION>::value; __NL__ \ __NL__ \ - /* The caller type adds another level of indirection that __NL__ \ - * is required to enable some hooks not to be implemented __NL__ \ - * by plugins. __NL__ \ - */ __NL__ \ + /* The caller type adds another level of indirection that */ __NL__ \ + /* is required to enable some hooks not to be implemented */ __NL__ \ + /* by plugins. */ __NL__ \ + __NL__ \ typedef _NAME5(EventHandler_, HOOK_NAME, _v, HOOK_VERSION, _caller) __NL__ \ < __NL__ \ derived_implements_hook, __NL__ \ @@ -147,7 +147,7 @@ } __NL__ \ }; __NL__ \ __NL__ \ - } __NL__ \ + } __NL__ \ __NL__ \ namespace kaleidoscope { __NL__ \ __NL__ \ diff --git a/src/kaleidoscope_internal/eventhandler_signature_check.h b/src/kaleidoscope_internal/eventhandler_signature_check.h index 5fdf3c31..17616fca 100644 --- a/src/kaleidoscope_internal/eventhandler_signature_check.h +++ b/src/kaleidoscope_internal/eventhandler_signature_check.h @@ -77,16 +77,16 @@ template struct #define _DEFINE_IMPLEMENTATION_CHECK_CLASSES(HOOK_NAME, ...) \ __NL__ \ - /* Defines a traits class Plugin_HasMember_HOOK_NAME __NL__ \ - * where HOOK_NAME is replaced with the actual hook name __NL__ \ - * that is passed in as a parameter to this macro. __NL__ \ - */ __NL__ \ + /* Defines a traits class Plugin_HasMember_HOOK_NAME */ __NL__ \ + /* where HOOK_NAME is replaced with the actual hook name */ __NL__ \ + /* that is passed in as a parameter to this macro. */ __NL__ \ + __NL__ \ DEFINE_HAS_MEMBER_TRAITS(Plugin, HOOK_NAME) __NL__ \ __NL__ \ - /* Specializations of this helper class check if a plugin __NL__ \ - * implements a handler with the specific signature that is __NL__ \ - * identified by a hook version. __NL__ \ - */ __NL__ \ + /* Specializations of this helper class check if a plugin */ __NL__ \ + /* implements a handler with the specific signature that is */ __NL__ \ + /* identified by a hook version. */ __NL__ \ + __NL__ \ template __NL__ \ struct HookVersionImplemented_##HOOK_NAME {}; @@ -96,19 +96,19 @@ template struct TMPL_PARAM_TYPE_LIST, TMPL_PARAM_LIST, TMPL_DUMMY_ARGS_LIST, \ SIGNATURE, ARGS_LIST) \ \ - /* We use the generalized traits class found in header has_method.h __NL__ \ - * to do check if a plugin defines a hook method with a specific __NL__ \ - * signature. __NL__ \ - */ __NL__ \ + /* We use the generalized traits class found in header has_method.h */ __NL__ \ + /* to do check if a plugin defines a hook method with a specific */ __NL__ \ + /* signature. */ __NL__ \ + __NL__ \ DEFINE_HAS_METHOD_TRAITS(GLUE2(Plugin, HOOK_VERSION), __NL__ \ TMPL_PARAM_TYPE_LIST, TMPL_PARAM_LIST, __NL__ \ HOOK_NAME, __NL__ \ kaleidoscope::EventHandlerResult, __NL__ \ SIGNATURE) __NL__ \ __NL__ \ - /* This specialization checks if a plugin of type Plugin__ __NL__ \ - * implements a handler with given signature SIGNATURE. __NL__ \ - */ __NL__ \ + /* This specialization checks if a plugin of type Plugin__ */ __NL__ \ + /* implements a handler with given signature SIGNATURE. */ __NL__ \ + __NL__ \ template __NL__ \ struct HookVersionImplemented_##HOOK_NAME __NL__ \ : public GLUE4(Plugin, HOOK_VERSION, _HasMethod_, HOOK_NAME) __NL__ \ @@ -117,20 +117,20 @@ template struct #define _PREPARE_EVENT_HANDLER_SIGNATURE_CHECK_START(HOOK_NAME, ...) \ __NL__ \ - /* This struct enables checking if a handler of a specific type __NL__ \ - * has been implemented. If so, there must be exactly one overload __NL__ \ - * with correct signature. __NL__ \ - */ __NL__ \ + /* This struct enables checking if a handler of a specific type */__NL__ \ + /* has been implemented. If so, there must be exactly one overload */__NL__ \ + /* with correct signature. */__NL__ \ + __NL__ \ template __NL__ \ struct NumberOfImplementationsOf_##HOOK_NAME __NL__ \ { __NL__ \ static constexpr int value = __NL__ \ 0 __NL__ \ - /* What follows is a list of handler implementation __NL__ \ - * checks for different versions of a handler __NL__ \ - * generated by several calls to __NL__ \ - * _PREPARE_EVENT_HANDLER_SIGNATURE_CHECK_OP. __NL__ \ - */ + /* What follows is a list of handler implementation */ __NL__ \ + /* checks for different versions of a handler */ __NL__ \ + /* generated by several calls to */ __NL__ \ + /* _PREPARE_EVENT_HANDLER_SIGNATURE_CHECK_OP. */ + // This is invoked for every version of a hook. // @@ -151,16 +151,16 @@ template struct static constexpr int n_implementations __NL__ \ = NumberOfImplementationsOf_##HOOK_NAME::value; __NL__ \ __NL__ \ - /* A handler is acceptable if it is either not implemented __NL__ \ - * by the derived class or if there is only one implementation __NL__ \ - * with correct signature. __NL__ \ - * Please note that any other methods with different names __NL__ \ - * but other, unrelated signatures are ignored as long __NL__ \ - * as there is one correct implementation. __NL__ \ - * Only if there are several versions supported at a time __NL__ \ - * and more than one of them has been implemented, we __NL__ \ - * treat this as an ambiguity and raise an error. __NL__ \ - */ __NL__ \ + /* A handler is acceptable if it is either not implemented */ __NL__ \ + /* by the derived class or if there is only one implementation */ __NL__ \ + /* with correct signature. */ __NL__ \ + /* Please note that any other methods with different names */ __NL__ \ + /* but other, unrelated signatures are ignored as long */ __NL__ \ + /* as there is one correct implementation. */ __NL__ \ + /* Only if there are several versions supported at a time */ __NL__ \ + /* and more than one of them has been implemented, we */ __NL__ \ + /* treat this as an ambiguity and raise an error. */ __NL__ \ + __NL__ \ static constexpr bool handler_has_wrong_signature = __NL__ \ derived_implements_handler && (n_implementations == 0); __NL__ \ __NL__ \ @@ -187,11 +187,11 @@ template struct VERBOSE_STATIC_ASSERT_FOOTER __NL__ \ ); __NL__ \ __NL__ \ - /* The following construct is necessary enable reporting of the __NL__ \ - * type of a plugin that implements an event handler with an __NL__ \ - * incorrect signature, because it's not possible to include any __NL__ \ - * non-literal string constant in a static_assert error message. __NL__ \ - */ __NL__ \ + /* The following construct is necessary enable reporting of the */ __NL__ \ + /* type of a plugin that implements an event handler with an */ __NL__ \ + /* incorrect signature, because it's not possible to include any */ __NL__ \ + /* non-literal string constant in a static_assert error message. */ __NL__ \ + /* */ __NL__ \ __attribute__((unused)) constexpr bool dummy1 __NL__ \ = ___________Culprit_Plugin___________ __NL__ \ ::value; __NL__ \ @@ -217,11 +217,11 @@ template struct VERBOSE_STATIC_ASSERT_FOOTER __NL__ \ ); __NL__ \ __NL__ \ - /* The following construct is necessary enable reporting of the __NL__ \ - * type of a plugin that implements an event handler with an __NL__ \ - * incorrect signature, because it's not possible to include any __NL__ \ - * non-literal string constant in a static_assert error message. __NL__ \ - */ __NL__ \ + /* The following construct is necessary enable reporting of the */ __NL__ \ + /* type of a plugin that implements an event handler with an */ __NL__ \ + /* incorrect signature, because it's not possible to include any */ __NL__ \ + /* non-literal string constant in a static_assert error message. */ __NL__ \ + __NL__ \ __attribute__((unused)) constexpr bool dummy2 __NL__ \ = ___________Culprit_Plugin___________ __NL__ \ ::value; __NL__ \ diff --git a/src/kaleidoscope_internal/type_traits/has_member.h b/src/kaleidoscope_internal/type_traits/has_member.h index 03f8fa33..a36cb1a5 100644 --- a/src/kaleidoscope_internal/type_traits/has_member.h +++ b/src/kaleidoscope_internal/type_traits/has_member.h @@ -40,89 +40,89 @@ #define DEFINE_HAS_MEMBER_TRAITS(PREFIX, MEMBER_NAME) __NL__ \ __NL__ \ - /* This defines a templated class PREFIX##_HasMember_##MEMBER_NAME. __NL__ \ - * The double hashes just glue together the value of macro __NL__ \ - * parameters like PREFIX or MEMBER_NAME and other __NL__ \ - * string tokens to form new identifiers (here the struct name). __NL__ \ - */ __NL__ \ + /* This defines a templated class PREFIX##_HasMember_##MEMBER_NAME.*/__NL__ \ + /* The double hashes just glue together the value of macro */ __NL__ \ + /* parameters like PREFIX or MEMBER_NAME and other */ __NL__ \ + /* string tokens to form new identifiers (here the struct name). */ __NL__ \ + /*/ */ __NL__ \ template __NL__ \ struct CAT3(PREFIX, _HasMember_, MEMBER_NAME) { __NL__ \ __NL__ \ - /* This code defines an inner class, Fallback, with one __NL__ \ - * member – named MEMBER_NAME (remember that MEMBER_NAME is a __NL__ \ - * macro parameter, so it will be replaced with the name of the __NL__ \ - * actual member. Using proper terminology, this class is __NL__ \ - * essentially a Mixin. __NL__ \ - */ __NL__ \ + /* This code defines an inner class, Fallback, with one */ __NL__ \ + /* member – named MEMBER_NAME (remember that MEMBER_NAME is a */ __NL__ \ + /* macro parameter, so it will be replaced with the name of the*/ __NL__ \ + /* actual member. Using proper terminology, this class is */ __NL__ \ + /* essentially a Mixin. */ __NL__ \ + __NL__ \ struct Fallback { __NL__ \ int MEMBER_NAME; __NL__ \ }; __NL__ \ __NL__ \ - /* Next, we introduce a new class: Derived. It inherits both __NL__ \ - * from the class T we’re templated on, and the previous Fallback __NL__ \ - * class. Note that the Derived class inherits the MEMBER_NAME __NL__ \ - * member from class Fallback and possibly another MEMBER_NAME __NL__ \ - * from T. Keep this (possible) ambiguity in mind. __NL__ \ - */ __NL__ \ + /* Next, we introduce a new class: Derived. It inherits both */ __NL__ \ + /* from the class T we’re templated on, & the previous Fallback*/ __NL__ \ + /* class. Note that the Derived class inherits the MEMBER_NAME */ __NL__ \ + /* member from class Fallback and possibly another MEMBER_NAME */ __NL__ \ + /* from T. Keep this (possible) ambiguity in mind. */ __NL__ \ + __NL__ \ struct Derived : T, Fallback { }; __NL__ \ __NL__ \ - /* The ChT class is templated on a typename C, and an object __NL__ \ - * of that type. As a side note, only compile time constant __NL__ \ - * fixed types are possible here. We will use this class to __NL__ \ - * generate the ambiguity mentioned above. __NL__ \ - */ __NL__ \ + /* The ChT class is templated on a typename C, and an object */ __NL__ \ + /* of that type. As a side note, only compile time constant */ __NL__ \ + /* fixed types are possible here. We will use this class to */ __NL__ \ + /* generate the ambiguity mentioned above. */ __NL__ \ + __NL__ \ template __NL__ \ struct ChT; __NL__ \ __NL__ \ - /* This is where the fun starts. These two lines form a __NL__ \ - * declaration of a templated function f. That function __NL__ \ - * receives a pointer to the ChT class, instantiated with a __NL__ \ - * pointer-to-member type whose parameter is the __NL__ \ - * address-of-member MEMBER_NAME in class C. Note that __NL__ \ - * if we attempt to instantiate this with __NL__ \ - * the Derived class, one of two things will happen: either we __NL__ \ - * will have a substitution failure due to the aforementioned __NL__ \ - * ambiguity (if T also has a member by that name), or it will __NL__ \ - * be successful (if there is no member called MEMBER_NAME, in T). __NL__ \ - * This function returns a reference to a char array of size 1. __NL__ \ - * __NL__ \ - * How returning arrays by reference works becomes a little __NL__ \ - * clearer by means of a more simple example. The definition __NL__ \ - * of a function that returns a reference to a char-array of __NL__ \ - * size 1 e.g. reads __NL__ \ - * __NL__ \ - * char (&f())[1]; __NL__ \ - */ __NL__ \ + /* This is where the fun starts. These two lines form a */ __NL__ \ + /* declaration of a templated function f. That function */ __NL__ \ + /* receives a pointer to the ChT class, instantiated with a */ __NL__ \ + /* pointer-to-member type whose parameter is the */ __NL__ \ + /* address-of-member MEMBER_NAME in class C. Note that */ __NL__ \ + /* if we attempt to instantiate this with */ __NL__ \ + /* the Derived class, one of two things will happen: either we */ __NL__ \ + /* will have a substitution failure due to the aforementioned */ __NL__ \ + /* ambiguity (if T also has a member by that name), or it will */ __NL__ \ + /* be successful (if there is no member called MEMBER_NAME, in T).*/ __NL__ \ + /* This function returns a reference to a char array of size 1.*/ __NL__ \ + /* */ __NL__ \ + /* How returning arrays by reference works becomes a little */ __NL__ \ + /* clearer by means of a more simple example. The definition */ __NL__ \ + /* of a function that returns a reference to a char-array of */ __NL__ \ + /* size 1 e.g. reads */ __NL__ \ + /* */ __NL__ \ + /* char (&f())[1]; */ __NL__ \ + __NL__ \ template __NL__ \ static char (&f(ChT*))[1]; __NL__ \ - __NL__ \ - /* This is what gets instantiated if the previous template __NL__ \ - * can’t be instantiated and SFINAE kicks in (since variadic __NL__ \ - * functions have the lowest possible priority when selecting __NL__ \ - * which overloaded function to call). This variadic function __NL__ \ - * returns a reference to a char array of size 2. Note that __NL__ \ - * instantiation of this function means that the previous __NL__ \ - * one failed, implying that class T has a member __NL__ \ - * named MEMBER_NAME. __NL__ \ - */ __NL__ \ + __NL__ \ + /* This is what gets instantiated if the previous template */ __NL__ \ + /* can’t be instantiated and SFINAE kicks in (since variadic */ __NL__ \ + /* functions have the lowest possible priority when selecting */ __NL__ \ + /* which overloaded function to call). This variadic function */ __NL__ \ + /* returns a reference to a char array of size 2. Note that */ __NL__ \ + /* instantiation of this function means that the previous */ __NL__ \ + /* one failed, implying that class T has a member */ __NL__ \ + /* named MEMBER_NAME. */ __NL__ \ + __NL__ \ template __NL__ \ static char (&f(...))[2]; __NL__ \ __NL__ \ - /* As you could guess, we will try to check which f function __NL__ \ - * can be instantiated. We will do this by checking the sizeof __NL__ \ - * of the return value of that f. If the first signature did __NL__ \ - * not fit (could not be instantiated), then according to __NL__ \ - * SFINAE the second one will be the chosen one __NL__ \ - * (since it can’t fail) and we will take the sizeof of a __NL__ \ - * char array of size 2, which is 2. Therefore, the value __NL__ \ - * will be evaluated to true – meaning that class T really __NL__ \ - * has a member by the name MEMBER_NAME. Otherwise, the first __NL__ \ - * function can be successfully instantiated, and we will measure __NL__ \ - * the sizeof of a char array of size 1, which is 1. In that case __NL__ \ - * the value is evaluated to false – which is good for us, since __NL__ \ - * that means there was no ambiguity when using __NL__ \ - * Derived::MEMBER_NAME, and that means there was no other __NL__ \ - * MEMBER_NAME but the one in Fallback. __NL__ \ - */ __NL__ \ + /* As you could guess, we will try to check which f function */ __NL__ \ + /* can be instantiated. We will do this by checking the sizeof */ __NL__ \ + /* of the return value of that f. If the first signature did */ __NL__ \ + /* not fit (could not be instantiated), then according to */ __NL__ \ + /* SFINAE the second one will be the chosen one */ __NL__ \ + /* (since it can’t fail) and we will take the sizeof of a */ __NL__ \ + /* char array of size 2, which is 2. Therefore, the value */ __NL__ \ + /* will be evaluated to true – meaning that class T really */ __NL__ \ + /* has a member by the name MEMBER_NAME. Otherwise, the first */ __NL__ \ + /* function can be successfully instantiated, and we will */ __NL__ \ + /* measure the sizeof of a char array of size 1, which is 1. */ __NL__ \ + /* In that case, the value is evaluated to false – which is */ __NL__ \ + /* good for us sincethat means there was no ambiguity when */ __NL__ \ + /* using Derived::MEMBER_NAME, and that means there was no */ __NL__ \ + /* other MEMBER_NAME but the one in Fallback. */ __NL__ \ + __NL__ \ static bool const value = sizeof(f(0)) == 2; __NL__ \ }; diff --git a/src/kaleidoscope_internal/type_traits/has_method.h b/src/kaleidoscope_internal/type_traits/has_method.h index 11431ced..577d201e 100644 --- a/src/kaleidoscope_internal/type_traits/has_method.h +++ b/src/kaleidoscope_internal/type_traits/has_method.h @@ -23,40 +23,40 @@ METHOD_NAME, \ RETURN_TYPE, ARGUMENTS) \ __NL__ \ - /* This traits checks if a class of type Class__ __NL__ \ - * implements a method with given signature. __NL__ \ - */ __NL__ \ + /* This traits checks if a class of type Class__ */ __NL__ \ + /* implements a method with given signature. */ __NL__ \ + __NL__ \ template __NL__ \ struct GLUE3(PREFIX, _HasMethod_, METHOD_NAME) __NL__ \ { __NL__ \ - /* Define a pointer to member function with the correct __NL__ \ - * argument signature. The newly defined type is named __NL__ \ - * MethodType__. __NL__ \ - */ __NL__ \ + /* Define a pointer to member function with the correct */ __NL__ \ + /* argument signature. The newly defined type is named */ __NL__ \ + /* MethodType__. */ __NL__ \ + /* */ __NL__ \ typedef RETURN_TYPE (Class__::*MethodType__)ARGUMENTS; __NL__ \ __NL__ \ - /* This is an application of the SFINAE concept. __NL__ \ - * We check if Class__ defines a method with given name and __NL__ \ - * signature. This is done by forcing the compiler __NL__ \ - * through a static cast to select the respective method __NL__ \ - * if possible. If the method signature cannot be found, __NL__ \ - * the substitution fails and the first version of method "test" __NL__ \ - * will not be defined. __NL__ \ - */ __NL__ \ + /* This is an application of the SFINAE concept. */ __NL__ \ + /* We check if Class__ defines a method with given name and */ __NL__ \ + /* signature. This is done by forcing the compiler */ __NL__ \ + /* through a static cast to select the respective method */ __NL__ \ + /* if possible. If the method signature cannot be found, */ __NL__ \ + /* the substitution fails and the first version of method "test"*/ __NL__ \ + /* will not be defined. */ __NL__ \ + __NL__ \ template __NL__ \ static constexpr __NL__ \ - /* The following decltype-clause defines the function return type __NL__ \ - */ __NL__ \ + /* The following decltype-clause defines the function return type */ __NL__ \ + __NL__ \ decltype( __NL__ \ - /* If &ClassAux__::METHOD_NAME exists and is of type __NL__ \ - * MethodType__, the list below evaluates to bool{} whose __NL__ \ - * type can be determined. Otherwise the comma expression __NL__ \ - * cannot be evaluated and the content __NL__ \ - * of decltype is undefined and this function overload __NL__ \ - * is ignored by the compiler __NL__ \ - * (SFINAE = substitution failure is not an error) __NL__ \ - * and the test(...) overload is used instead. __NL__ \ - */ __NL__ \ + /* If &ClassAux__::METHOD_NAME exists and is of type */ __NL__ \ + /* MethodType__, the list below evaluates to bool{} whose */ __NL__ \ + /* type can be determined. Otherwise the comma expression */ __NL__ \ + /* cannot be evaluated and the content */ __NL__ \ + /* of decltype is undefined and this function overload */ __NL__ \ + /* is ignored by the compiler */ __NL__ \ + /* (SFINAE = substitution failure is not an error) */ __NL__ \ + /* and the test(...) overload is used instead. */ __NL__ \ + __NL__ \ static_cast( __NL__ \ &ClassAux__::TEMPLATE_KEYWORD(UNWRAP TMPL_PARAM_LIST) __NL__ \ METHOD_NAME ADD_TEMPLATE_BRACES(UNWRAP TMPL_PARAM_LIST) __NL__ \