2014-04-28 12:17 GMT-04:00 Birunthan Mohanathas <birunt...@mohanathas.com>:

> On 28 April 2014 14:18, Benoit Jacob <jacob.benoi...@gmail.com> wrote:
> > Question: is there a plan to switch to an implementation based on
> variadic
> > templates when we will stop supporting compilers that don't support
> them? Do
> > you know when that would be (of the compilers that we currently support,
> > which ones don't support variadic templates?)
>
> I don't think a purely variadic template based solution is possible
> (e.g. due to argument stringification employed by NS_IMPL_ADDREF and
> others).
>

Would it be possible to have a variadic macro that takes N arguments,
stringifies them, and passes all 2N resulting values (the original N
arguments and their N stringifications) to a variadic template?

Benoit


>
> As for compiler support, I believe our current MSVC version is the
> only one lacking variadic templates. I don't know if/when we are going
> to switch to VS2013.
>
> On 28 April 2014 12:07, Henri Sivonen <hsivo...@hsivonen.fi> wrote:
> > Cool. Is there a script that rewrites mq patches whose context has
> > numbered macros to not expect numbered macros?
>
> Something like this should work (please use with caution because it's
> Perl and because I only did a quick test):
>
> perl -i.bak -0777 -pe '
>     $names = join("|", (
>         "NS_IMPL_CI_INTERFACE_GETTER#",
>         "NS_IMPL_CYCLE_COLLECTION_#",
>         "NS_IMPL_CYCLE_COLLECTION_INHERITED_#",
>         "NS_IMPL_ISUPPORTS#",
>         "NS_IMPL_ISUPPORTS#_CI",
>         "NS_IMPL_ISUPPORTS_INHERITED#",
>         "NS_IMPL_QUERY_INTERFACE#",
>         "NS_IMPL_QUERY_INTERFACE#_CI",
>         "NS_IMPL_QUERY_INTERFACE_INHERITED#",
>         "NS_INTERFACE_TABLE#",
>         "NS_INTERFACE_TABLE_INHERITED#",
>     )) =~ s/#/[1-9]\\d?/gr;
>
>     sub rep {
>         my ($name, $args) = @_;
>         my $unnumbered_name = $name =~ s/_?\d+//r;
>         my $spaces_to_remove = length($name) - length($unnumbered_name);
>         $args =~ s/^(. {16}) {$spaces_to_remove}/\1/gm;
>         return $unnumbered_name . $args;
>     }
>
>     s/($names)(\(.*?\))/rep($1, $2)/ges;
> ' some-patch.diff
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to