From 51a5398dc77fcd792fef3fff9cbd072c7bebe45b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludwig=20J=C3=A4ck?= Date: Thu, 6 Jun 2024 11:13:07 +0200 Subject: [PATCH] Remove LIBT2N_DEFAULT_ARG macros The macro is no longer needed with castxml since the original issue (i2n mantis #1427) from 2008 with disappearing default arguments in the XML output is no longer reproducible. We could not reproduce it anymore with gccxml from 2011 either. --- codegen/codegen-stubhead.hxx | 17 ----------------- codegen/main.cpp | 18 ++---------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/codegen/codegen-stubhead.hxx b/codegen/codegen-stubhead.hxx index 3009da1..19735c1 100644 --- a/codegen/codegen-stubhead.hxx +++ b/codegen/codegen-stubhead.hxx @@ -44,26 +44,9 @@ on this file might be covered by the GNU General Public License. */ #define LIBT2N_EXPORT __attribute__((annotate("libt2n-default"))) - -/** @brief tell libt2n about a default argument - @param type type of the default argument - @param value default value - @par Example - @code - LIBT2N_EXPORT std::string testfunc(LIBT2N_DEFAULT_ARG(const std::string str&,"hello world")) - { - // your code here - } - @endcode - @remarks Codegen gets default arguments via this define (gccxml-attribute) because gccxml - does not correctly output them (e.g. the namespace is ambiguous) -*/ -#define LIBT2N_DEFAULT_ARG(type,value) __attribute__((annotate("libt2n-default-arg,"#value))) type = value - #else // used during regular compile #define LIBT2N_EXPORT -#define LIBT2N_DEFAULT_ARG(type,value) type = value #endif diff --git a/codegen/main.cpp b/codegen/main.cpp index 3060ee4..e3a89ec 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -338,22 +338,8 @@ protected: assert(arg->get_attribute("type")); a.type=get_type(root, arg->get_attribute("type")->get_value()); - // this would be the nice way of solving the problem of default arguments - // but currently the output of gccxml is unreliable (e.g. namespace only - // sometimes available) - // if(arg->get_attribute("default")) - // a.defaultArg=arg->get_attribute("default")->get_value(); - - // so we need to get the def. arg. via attribute - // which is previously set by the macro LIBT2N_DEFAULT_ARG(type,value) - if(arg->get_attribute("attributes")) - { - std::string attr=arg->get_attribute("attributes")->get_value(); - const std::string look_for = "annotate(libt2n-default-arg,"; - - if (attr.compare(0,look_for.size(),look_for) == 0) - a.defaultArg=attr.substr(look_for.size(),attr.size()-look_for.size()-1); - } + if(arg->get_attribute("default")) + a.defaultArg=arg->get_attribute("default")->get_value(); // todo: ugly - could be any other error if (a.type.name.empty()) -- 1.7.1