[Mono-dev] Is there any reason to not add instead a flag?
Miguel de Icaza
miguel at novell.com
Tue Aug 10 15:41:10 EDT 2010
In your recent commit, you added a new command to mcs/tools/corcompare,
the mono-abi-info tool. I do not know what this tool does, and I do
not know why we could not just have used mono-api-info with a new flag
--abi instead of installing another executable.
It goes against the "If it is not documented, it does not exist" rule.
So can we:
(a) get this merged into mono-api-info
(b) document this on the wiki or the relevant man pages?
miguel
> Branch: refs/heads/master
> Home: http://github.com/mono/mono
>
> Commit: c508a786c106ceff274b9b985919368b6b404342
> Author: Andrés G. Aragoneses <knocte at gmail.com>
> Date: 08/10/2010 14:36:27
> URL: http://github.com/mono/mono/commit/c508a786c106ceff274b9b985919368b6b404342
>
> Added new ABI mode to mono-api-info tool, wrapped in a mono-abi-info script.
>
> 2010-08-05 Andrés G. Aragoneses <andres at lindenlab.com>
>
> * mcs/tools/corcompare/mono-api-info.cs: Implemented new mode to show ABI.
> * mcs/tools/corcompare/Makefile: added mono-abi-info autofoo.
> * scripts/.gitignore: added mono-abi-info.
> * scripts/Makefile.am: added mono-abi-info autofoo.
>
> Changed paths:
> M ChangeLog
> M mcs/tools/corcompare/ChangeLog
> M mcs/tools/corcompare/Makefile
> M mcs/tools/corcompare/mono-api-info.cs
> M scripts/.gitignore
> M scripts/Makefile.am
>
> Modified: ChangeLog
> ===================================================================
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-08-05 Andr??s G. Aragoneses <andres at lindenlab.com>
> +
> + * scripts/.gitignore: added mono-abi-info.
> + * scripts/Makefile.am: added mono-abi-info autofoo.
> +
> 2010-07-16 Zoltan Varga <vargaz at gmail.com>
>
> * configure.in: Remove the 'LLVM backend is experimental' warning.
> Modified: mcs/tools/corcompare/ChangeLog
> ===================================================================
> --- a/mcs/tools/corcompare/ChangeLog
> +++ b/mcs/tools/corcompare/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-08-05 Andr??s G. Aragoneses <andres at lindenlab.com>
> +
> + * mono-api-info.cs: Implemented new mode to show ABI.
> + * Makefile: added mono-abi-info autofoo.
> +
> 2010-04-16 C.J. Adams-Collier <cjac at colliertech.org>
>
> * mono-api-diff.cs: revived from the mono-2-2 branch and applied
> Modified: mcs/tools/corcompare/Makefile
> ===================================================================
> --- a/mcs/tools/corcompare/Makefile
> +++ b/mcs/tools/corcompare/Makefile
> @@ -2,7 +2,7 @@ thisdir = tools/corcompare
> SUBDIRS =
> include ../../build/rules.make
>
> -ALL_PROGRAMS = mono-api-info.exe
> +ALL_PROGRAMS = mono-api-info.exe mono-abi-info.exe
>
> CECIL = ../../class/lib/net_2_0/Mono.Cecil.dll
>
> @@ -43,3 +43,6 @@ dist-local: dist-default
>
> mono-api-info.exe: $(APIINFO_SOURCES)
> $(CSCOMPILE) -r:$(CECIL) -out:$@ $^
> +
> +mono-abi-info.exe: $(APIINFO_SOURCES)
> + $(CSCOMPILE) -r:$(CECIL) -d:ABI -out:$@ $^
> Modified: mcs/tools/corcompare/mono-api-info.cs
> ===================================================================
> --- a/mcs/tools/corcompare/mono-api-info.cs
> +++ b/mcs/tools/corcompare/mono-api-info.cs
> @@ -29,6 +29,9 @@ namespace CorCompare
> if (args.Length == 0)
> return 1;
>
> + AbiMode = false;
> + SetAbiMode ();
> +
> AssemblyCollection acoll = new AssemblyCollection ();
>
> foreach (string fullName in args) {
> @@ -45,6 +48,14 @@ namespace CorCompare
> doc.WriteTo (writer);
> return 0;
> }
> +
> + [System.Diagnostics.Conditional ("ABI")]
> + private static void SetAbiMode ()
> + {
> + AbiMode = true;
> + }
> +
> + internal static bool AbiMode { get; private set; }
> }
>
> public class Utils {
> @@ -211,7 +222,7 @@ namespace CorCompare
> if (string.IsNullOrEmpty (t.Namespace))
> continue;
>
> - if ((t.Attributes & TypeAttributes.VisibilityMask) != TypeAttributes.Public)
> + if (!Driver.AbiMode && ((t.Attributes & TypeAttributes.VisibilityMask) != TypeAttributes.Public))
> continue;
>
> if (t.DeclaringType != null)
> @@ -409,28 +420,31 @@ namespace CorCompare
> AddAttribute (nclass, "enumtype", Utils.CleanupTypeName (value_type.FieldType));
> }
>
> - MethodDefinition [] ctors = GetConstructors (type);
> - if (ctors.Length > 0) {
> - Array.Sort (ctors, MemberReferenceComparer.Default);
> - members.Add (new ConstructorData (document, nclass, ctors));
> - }
> + if (!Driver.AbiMode) {
>
> - PropertyDefinition[] properties = GetProperties (type);
> - if (properties.Length > 0) {
> - Array.Sort (properties, MemberReferenceComparer.Default);
> - members.Add (new PropertyData (document, nclass, properties));
> - }
> + MethodDefinition [] ctors = GetConstructors (type);
> + if (ctors.Length > 0) {
> + Array.Sort (ctors, MemberReferenceComparer.Default);
> + members.Add (new ConstructorData (document, nclass, ctors));
> + }
>
> - EventDefinition [] events = GetEvents (type);
> - if (events.Length > 0) {
> - Array.Sort (events, MemberReferenceComparer.Default);
> - members.Add (new EventData (document, nclass, events));
> - }
> + PropertyDefinition[] properties = GetProperties (type);
> + if (properties.Length > 0) {
> + Array.Sort (properties, MemberReferenceComparer.Default);
> + members.Add (new PropertyData (document, nclass, properties));
> + }
> +
> + EventDefinition [] events = GetEvents (type);
> + if (events.Length > 0) {
> + Array.Sort (events, MemberReferenceComparer.Default);
> + members.Add (new EventData (document, nclass, events));
> + }
>
> - MethodDefinition [] methods = GetMethods (type);
> - if (methods.Length > 0) {
> - Array.Sort (methods, MemberReferenceComparer.Default);
> - members.Add (new MethodData (document, nclass, methods));
> + MethodDefinition [] methods = GetMethods (type);
> + if (methods.Length > 0) {
> + Array.Sort (methods, MemberReferenceComparer.Default);
> + members.Add (new MethodData (document, nclass, methods));
> + }
> }
>
> foreach (MemberData md in members)
> @@ -542,12 +556,19 @@ namespace CorCompare
> if (field.IsSpecialName)
> continue;
>
> + if (Driver.AbiMode && field.IsStatic)
> + continue;
> +
> // we're only interested in public or protected members
> FieldAttributes maskedVisibility = (field.Attributes & FieldAttributes.FieldAccessMask);
> - if (maskedVisibility == FieldAttributes.Public
> - || maskedVisibility == FieldAttributes.Family
> - || maskedVisibility == FieldAttributes.FamORAssem) {
> + if (Driver.AbiMode && !field.IsNotSerialized) {
> list.Add (field);
> + } else {
> + if (maskedVisibility == FieldAttributes.Public
> + || maskedVisibility == FieldAttributes.Family
> + || maskedVisibility == FieldAttributes.FamORAssem) {
> + list.Add (field);
> + }
> }
> }
>
> Modified: scripts/.gitignore
> ===================================================================
> --- a/scripts/.gitignore
> +++ b/scripts/.gitignore
> @@ -42,6 +42,7 @@
> /mkbundle2
> /mod
> /mono-api-diff
> +/mono-abi-info
> /mono-api-info
> /mono-api-info1
> /mono-api-info2
> Modified: scripts/Makefile.am
> ===================================================================
> --- a/scripts/Makefile.am
> +++ b/scripts/Makefile.am
> @@ -82,6 +82,7 @@ scripts_4_0 = \
> mconfig$(SCRIPT_SUFFIX) \
> mod$(SCRIPT_SUFFIX) \
> monolinker$(SCRIPT_SUFFIX) \
> + mono-abi-info$(SCRIPT_SUFFIX) \
> mono-api-info$(SCRIPT_SUFFIX) \
> mono-shlib-cop$(SCRIPT_SUFFIX) \
> mozroots$(SCRIPT_SUFFIX) \
>
>
>
>
> _______________________________________________
> Mono-patches maillist - Mono-patches at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-patches
More information about the Mono-devel-list
mailing list