Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Darin Adler
> On Dec 3, 2017, at 12:16 PM, Filip Pizlo  wrote:
> 
> That also means not using static, for the same reason. FWIW, I think it’s a 
> good idea.

Maybe.

There is definitely no benefit in wrapping a class, structure, or type 
definition in an anonymous namespace. My comment was specifically about a 
structure.

For functions and global variables, static or anonymous namespace does have one 
remaining benefit. It’s a way to communicate to the compiler’s warning system 
and the -Wmissing-declarations warning that the function does not need to have 
been previously declared in a header. So, for WebKit, these would not mean “I 
can rely on the fact that this name is private to this file”. They would mean 
“I only intend to use this in this file and so did not declare it in a header 
and so please don’t warn me about the fact that I did not”.

— Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Filip Pizlo
That also means not using static, for the same reason. FWIW, I think it’s a 
good idea. 

-Filip

> On Dec 3, 2017, at 12:10 PM, Darin Adler  wrote:
> 
> I think it’s also worthwhile to remove the anonymous namespace wrapping each 
> of these DestroyFunc structures when renaming them. Generally speaking, 
> anonymous namespace doesn’t work when compilation units are arbitrary, since 
> they say “limit this to one compilation unit”. So I’m not sure we should ever 
> use them any more.
> 
> — Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Caio Lima
I agree on that. The Patch on the way as well and I will fix it.

https://bugs.webkit.org/show_bug.cgi?id=180335

Em dom, 3 de dez de 2017 às 18:10, Darin Adler  escreveu:

> I think it’s also worthwhile to remove the anonymous namespace wrapping
> each of these DestroyFunc structures when renaming them. Generally
> speaking, anonymous namespace doesn’t work when compilation units are
> arbitrary, since they say “limit this to one compilation unit”. So I’m not
> sure we should ever use them any more.
>
> — Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Darin Adler
I think it’s also worthwhile to remove the anonymous namespace wrapping each of 
these DestroyFunc structures when renaming them. Generally speaking, anonymous 
namespace doesn’t work when compilation units are arbitrary, since they say 
“limit this to one compilation unit”. So I’m not sure we should ever use them 
any more.

— Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Caio Lima
Ok.

It's a common pattern to use "struct DestroyFunc {".

I'm going to rename all of them.

Em dom, 3 de dez de 2017 às 14:52, Filip Pizlo  escreveu:

> Maybe just give that DestroyFunc a more unique name like
> JSSegmentedVariableObjectDestroyFunc. Cc me on such a patch and I’ll
> happily review it.
>
> -Filip
>
> > On Dec 3, 2017, at 8:44 AM, Caio Lima  wrote:
> >
> > Hi guys. I'm working in a Patch that is adding some files to JSC and I
> faced following issue:
> >
> > ./runtime/JSStringHeapCellType.cpp:36:8: error: redefinition of
> 'DestroyFunc'
> > ...
> > In file included from /Users/caiolima/open_projects/
> WebKit/WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/
> UnifiedSource109.cpp:1:
> > ./runtime/JSSegmentedVariableObjectHeapCellType.cpp:36:8: note:
> previous definition is here
> >
> > That is my UnifiedSource109.cpp content:
> >
> > #include "runtime/JSSegmentedVariableObjectHeapCellType.cpp"
> > #include "runtime/JSSet.cpp"
> > #include "runtime/JSSetIterator.cpp"
> > #include "runtime/JSSourceCode.cpp"
> > #include "runtime/JSString.cpp"
> > #include "runtime/JSStringHeapCellType.cpp"
> > #include "runtime/JSStringIterator.cpp"
> > #include "runtime/JSStringJoiner.cpp"
> >
> > So, I tried to use "namespace FILENAME" magic, but it doesn't seem
> working, mainly because there is no other file using it.
> >
> > What are the actions do I need to take in such case to fix it properly?
> >
> > Regards,
> > Caio.
> > ___
> > webkit-dev mailing list
> > webkit-dev@lists.webkit.org
> > https://lists.webkit.org/mailman/listinfo/webkit-dev
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Build issues due to anonymous namespace

2017-12-03 Thread Filip Pizlo
Maybe just give that DestroyFunc a more unique name like 
JSSegmentedVariableObjectDestroyFunc. Cc me on such a patch and I’ll happily 
review it. 

-Filip

> On Dec 3, 2017, at 8:44 AM, Caio Lima  wrote:
> 
> Hi guys. I'm working in a Patch that is adding some files to JSC and I faced 
> following issue:
> 
> ./runtime/JSStringHeapCellType.cpp:36:8: error: redefinition of 'DestroyFunc'
> ...
> In file included from 
> /Users/caiolima/open_projects/WebKit/WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource109.cpp:1:
> ./runtime/JSSegmentedVariableObjectHeapCellType.cpp:36:8: note: previous 
> definition is here
> 
> That is my UnifiedSource109.cpp content:
> 
> #include "runtime/JSSegmentedVariableObjectHeapCellType.cpp"
> #include "runtime/JSSet.cpp"
> #include "runtime/JSSetIterator.cpp"
> #include "runtime/JSSourceCode.cpp"
> #include "runtime/JSString.cpp"
> #include "runtime/JSStringHeapCellType.cpp"
> #include "runtime/JSStringIterator.cpp"
> #include "runtime/JSStringJoiner.cpp"
> 
> So, I tried to use "namespace FILENAME" magic, but it doesn't seem working, 
> mainly because there is no other file using it. 
> 
> What are the actions do I need to take in such case to fix it properly?
> 
> Regards,
> Caio.
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev