[vala/wip/issue/713: 43/44] compiler: Deprecate --use-header option and enable this feature by default



commit 3bd392368d10c90720695b7b24e144e980a80288
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Jul 15 15:27:53 2019 +0200

    compiler: Deprecate --use-header option and enable this feature by default
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/713

 codegen/valaccodebasemodule.vala | 4 ++--
 compiler/valacompiler.vala       | 7 +------
 vala/valacodecontext.vala        | 2 --
 3 files changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index a21b8f315..891ea92f5 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -677,13 +677,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        sym.source_reference.file.used = true;
                }
                if (sym.anonymous) {
-                       return !decl_space.is_header && CodeContext.get ().use_header;
+                       return !decl_space.is_header;
                }
                // constants with initializer-list are special
                if (sym is Constant && ((Constant) sym).value is InitializerList) {
                        return false;
                }
-               if (sym.external_package || (!decl_space.is_header && CodeContext.get ().use_header && 
!sym.is_internal_symbol ())
+               if (sym.external_package || (!decl_space.is_header && !sym.is_internal_symbol ())
                    || (sym.is_extern && get_ccode_header_filenames (sym).length > 0)) {
                        // add feature test macros
                        foreach (unowned string feature_test_macro in get_ccode_feature_test_macros 
(sym).split (",")) {
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index e7f7db4ee..7e188cb1f 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -55,7 +55,6 @@ class Vala.Compiler {
        static bool ccode_only;
        static bool abi_stability;
        static string header_filename;
-       static bool use_header;
        static string internal_header_filename;
        static string internal_vapi_filename;
        static string fast_vapi_filename;
@@ -119,7 +118,7 @@ class Vala.Compiler {
                { "api-version", 0, 0, OptionArg.NONE, ref api_version, "Display API version number", null },
                { "ccode", 'C', 0, OptionArg.NONE, ref ccode_only, "Output C code", null },
                { "header", 'H', 0, OptionArg.FILENAME, ref header_filename, "Output C header file", "FILE" },
-               { "use-header", 0, 0, OptionArg.NONE, ref use_header, "Use C header file", null },
+               { "use-header", 0, OptionFlags.OPTIONAL_ARG | OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) 
option_deprecated, "Use C header file (DEPRECATED AND IGNORED)", null },
                { "includedir", 0, 0, OptionArg.FILENAME, ref includedir, "Directory used to include the C 
header file", "DIRECTORY" },
                { "internal-header", 'h', 0, OptionArg.FILENAME, ref internal_header_filename, "Output 
internal C header file", "FILE" },
                { "internal-vapi", 0, 0, OptionArg.FILENAME, ref internal_vapi_filename, "Output vapi with 
internal api", "FILE" },
@@ -255,10 +254,6 @@ class Vala.Compiler {
                context.abi_stability = abi_stability;
                context.compile_only = compile_only;
                context.header_filename = header_filename;
-               if (header_filename == null && use_header) {
-                       Report.error (null, "--use-header may only be used in combination with --header");
-               }
-               context.use_header = use_header;
                context.internal_header_filename = internal_header_filename;
                context.symbols_filename = symbols_filename;
                context.includedir = includedir;
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index 9f21b9139..17026505a 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -91,8 +91,6 @@ public class Vala.CodeContext {
         */
        public string? internal_header_filename { get; set; }
 
-       public bool use_header { get; set; }
-
        /**
         * Base directory used for header_filename in the VAPIs.
         */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]