mesa: Use quotes on bool driconf options to prevent stdbool.h breakage.
authorEric Anholt <eric@anholt.net>
Thu, 3 Jan 2013 01:02:58 +0000 (17:02 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 19 Apr 2013 17:10:22 +0000 (10:10 -0700)
Since stdbool.h's "true" and "false" are #defines, they got expanded when
used as macro arguments, and that expanded value was stored in the
XML string, producing XML that driconf would then fail to parse.

Currently no drivers included stdbool along with driconf, but I keep
accidentally doing so on intel as we move towards using normal C.

v2: rebase on master.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
src/gallium/state_trackers/dri/common/dri_screen.c
src/mesa/drivers/dri/common/xmlpool.h
src/mesa/drivers/dri/common/xmlpool/t_options.h
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c

index fd2971c29a07158626593c4f8790773666180789..e09fe1d38e7abdce5114e6186ef3ae3a8334e7c0 100644 (file)
@@ -54,7 +54,7 @@ PUBLIC const char __driConfigOptions[] =
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_QUALITY
-/*       DRI_CONF_FORCE_S3TC_ENABLE(false) */
+/*       DRI_CONF_FORCE_S3TC_ENABLE("false") */
          DRI_CONF_ALLOW_LARGE_TEXTURES(1)
          DRI_CONF_PP_CELSHADE(0)
          DRI_CONF_PP_NORED(0)
@@ -65,12 +65,12 @@ PUBLIC const char __driConfigOptions[] =
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_DEBUG
-         DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
-         DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
+         DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
+         DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_MISCELLANEOUS
-         DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(false)
+         DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
       DRI_CONF_SECTION_END
    DRI_CONF_END;
 
index ffea430024d61d4e425f1a3fa06525943ef74ce0..ebd4e7c863af2f9c2db8b44e3d5a3b5e5c8b91d1 100644 (file)
 #define DRI_CONF_OPT_BEGIN(name,type,def) \
 "<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n"
 
+/**
+ * \brief Begin a boolean option definition, with the default value passed in
+ * as a string
+ */
+#define DRI_CONF_OPT_BEGIN_B(name,def) \
+"<option name=\""#name"\" type=\"bool\" default="#def">\n"
+
 /** \brief Begin an option definition with quoted default value */
 #define DRI_CONF_OPT_BEGIN_Q(name,type,def) \
 "<option name=\""#name"\" type=\""#type"\" default="#def">\n"
index 7b441c68f2dad8c84e7fc3119952be1ae5e19574..ca4772003a4ebe79d5f02d32ff91864384632ff6 100644 (file)
@@ -56,42 +56,42 @@ DRI_CONF_SECTION_BEGIN \
        DRI_CONF_DESC(en,gettext("Debugging"))
 
 #define DRI_CONF_NO_RAST(def) \
-DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
+DRI_CONF_OPT_BEGIN_B(no_rast, def) \
         DRI_CONF_DESC(en,gettext("Disable 3D acceleration")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_PERFORMANCE_BOXES(def) \
-DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
+DRI_CONF_OPT_BEGIN_B(performance_boxes, def) \
         DRI_CONF_DESC(en,gettext("Show performance boxes")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
-DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \
+DRI_CONF_OPT_BEGIN_B(always_flush_batch, def) \
         DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
-DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \
+DRI_CONF_OPT_BEGIN_B(always_flush_cache, def) \
         DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_DISABLE_THROTTLING(def) \
-DRI_CONF_OPT_BEGIN(disable_throttling,bool,def) \
+DRI_CONF_OPT_BEGIN_B(disable_throttling, def) \
        DRI_CONF_DESC(en,gettext("Disable throttling on first batch after flush")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \
-DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \
+DRI_CONF_OPT_BEGIN_B(force_glsl_extensions_warn, def) \
         DRI_CONF_DESC(en,gettext("Force GLSL extension default behavior to 'warn'")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \
-DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \
+DRI_CONF_OPT_BEGIN_B(disable_blend_func_extended, def) \
         DRI_CONF_DESC(en,gettext("Disable dual source blending")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \
-DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \
+DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \
         DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
 DRI_CONF_OPT_END
 
@@ -105,7 +105,7 @@ DRI_CONF_SECTION_BEGIN \
        DRI_CONF_DESC(en,gettext("Image Quality"))
 
 #define DRI_CONF_EXCESS_MIPMAP(def) \
-DRI_CONF_OPT_BEGIN(excess_mipmap,bool,def) \
+DRI_CONF_OPT_BEGIN_B(excess_mipmap, def) \
        DRI_CONF_DESC(en,"Enable extra mipmap level") \
 DRI_CONF_OPT_END
 
@@ -129,12 +129,12 @@ DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_NO_NEG_LOD_BIAS(def) \
-DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
+DRI_CONF_OPT_BEGIN_B(no_neg_lod_bias, def) \
         DRI_CONF_DESC(en,gettext("Forbid negative texture LOD bias")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_FORCE_S3TC_ENABLE(def) \
-DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
+DRI_CONF_OPT_BEGIN_B(force_s3tc_enable, def) \
         DRI_CONF_DESC(en,gettext("Enable S3TC texture compression even if software support is not available")) \
 DRI_CONF_OPT_END
 
@@ -171,7 +171,7 @@ DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_FLOAT_DEPTH(def) \
-DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
+DRI_CONF_OPT_BEGIN_B(float_depth, def) \
         DRI_CONF_DESC(en,gettext("Floating point depth buffer")) \
 DRI_CONF_OPT_END
 
@@ -257,7 +257,7 @@ DRI_CONF_OPT_END
 #define DRI_CONF_HYPERZ_DISABLED 0
 #define DRI_CONF_HYPERZ_ENABLED 1
 #define DRI_CONF_HYPERZ(def) \
-DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
+DRI_CONF_OPT_BEGIN_B(hyperz, def) \
         DRI_CONF_DESC(en,gettext("Use HyperZ to boost performance")) \
 DRI_CONF_OPT_END
 
@@ -303,7 +303,7 @@ DRI_CONF_SECTION_BEGIN \
         DRI_CONF_DESC(en,gettext("Features that are not hardware-accelerated"))
 
 #define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
+DRI_CONF_OPT_BEGIN_B(arb_vertex_program, def) \
         DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \
 DRI_CONF_OPT_END
 
@@ -317,6 +317,6 @@ DRI_CONF_SECTION_BEGIN \
         DRI_CONF_DESC(en,gettext("Miscellaneous"))
 
 #define DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(def) \
-DRI_CONF_OPT_BEGIN(always_have_depth_buffer, bool, def) \
+DRI_CONF_OPT_BEGIN_B(always_have_depth_buffer, def) \
         DRI_CONF_DESC(en,gettext("Create all visuals with a depth buffer")) \
 DRI_CONF_OPT_END
index 33785df65ae1c540f047fd49b43e5351cb349de7..374517980e743a6e211e63b113cf4cd863e9ba20 100644 (file)
@@ -54,37 +54,37 @@ PUBLIC const char __driConfigOptions[] =
         DRI_CONF_DESC_END
       DRI_CONF_OPT_END
 
-      DRI_CONF_OPT_BEGIN(hiz, bool, true)
+      DRI_CONF_OPT_BEGIN_B(hiz, "true")
         DRI_CONF_DESC(en, "Enable Hierarchical Z on gen6+")
       DRI_CONF_OPT_END
 
-      DRI_CONF_OPT_BEGIN(early_z, bool, false)
+      DRI_CONF_OPT_BEGIN_B(early_z, "false")
         DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).")
       DRI_CONF_OPT_END
 
-      DRI_CONF_OPT_BEGIN(fragment_shader, bool, true)
+      DRI_CONF_OPT_BEGIN_B(fragment_shader, "true")
         DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.")
       DRI_CONF_OPT_END
 
    DRI_CONF_SECTION_END
    DRI_CONF_SECTION_QUALITY
-      DRI_CONF_FORCE_S3TC_ENABLE(false)
+      DRI_CONF_FORCE_S3TC_ENABLE("false")
       DRI_CONF_ALLOW_LARGE_TEXTURES(2)
    DRI_CONF_SECTION_END
    DRI_CONF_SECTION_DEBUG
-     DRI_CONF_NO_RAST(false)
-     DRI_CONF_ALWAYS_FLUSH_BATCH(false)
-     DRI_CONF_ALWAYS_FLUSH_CACHE(false)
-     DRI_CONF_DISABLE_THROTTLING(false)
-     DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
-     DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
-     DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
-
-      DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false)
+      DRI_CONF_NO_RAST("false")
+      DRI_CONF_ALWAYS_FLUSH_BATCH("false")
+      DRI_CONF_ALWAYS_FLUSH_CACHE("false")
+      DRI_CONF_DISABLE_THROTTLING("false")
+      DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
+      DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
+      DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
+
+      DRI_CONF_OPT_BEGIN_B(stub_occlusion_query, "false")
         DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.")
       DRI_CONF_OPT_END
 
-      DRI_CONF_OPT_BEGIN(shader_precompile, bool, true)
+      DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
         DRI_CONF_DESC(en, "Perform code generation at shader link time.")
       DRI_CONF_OPT_END
    DRI_CONF_SECTION_END
index 41460f982121f13b69468a85eef0898feddb00e8..04cb7afabbac3511f8005291da7c077710f5b618 100644 (file)
@@ -79,21 +79,21 @@ DRI_CONF_BEGIN
         DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
         DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
         DRI_CONF_MAX_TEXTURE_UNITS(3,2,3)
-        DRI_CONF_HYPERZ(false)
+        DRI_CONF_HYPERZ("false")
         DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
     DRI_CONF_SECTION_END
     DRI_CONF_SECTION_QUALITY
         DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
         DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
-        DRI_CONF_NO_NEG_LOD_BIAS(false)
-        DRI_CONF_FORCE_S3TC_ENABLE(false)
+        DRI_CONF_NO_NEG_LOD_BIAS("false")
+        DRI_CONF_FORCE_S3TC_ENABLE("false")
         DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
         DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
         DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
         DRI_CONF_ALLOW_LARGE_TEXTURES(2)
     DRI_CONF_SECTION_END
     DRI_CONF_SECTION_DEBUG
-        DRI_CONF_NO_RAST(false)
+        DRI_CONF_NO_RAST("false")
     DRI_CONF_SECTION_END
 DRI_CONF_END;
 static const GLuint __driNConfigOptions = 15;
@@ -107,14 +107,14 @@ DRI_CONF_BEGIN
         DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
         DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
         DRI_CONF_MAX_TEXTURE_UNITS(6,2,6)
-        DRI_CONF_HYPERZ(false)
+        DRI_CONF_HYPERZ("false")
         DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
     DRI_CONF_SECTION_END
     DRI_CONF_SECTION_QUALITY
         DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
         DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
-        DRI_CONF_NO_NEG_LOD_BIAS(false)
-        DRI_CONF_FORCE_S3TC_ENABLE(false)
+        DRI_CONF_NO_NEG_LOD_BIAS("false")
+        DRI_CONF_FORCE_S3TC_ENABLE("false")
         DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
         DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
         DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
@@ -122,7 +122,7 @@ DRI_CONF_BEGIN
         DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
     DRI_CONF_SECTION_END
     DRI_CONF_SECTION_DEBUG
-        DRI_CONF_NO_RAST(false)
+        DRI_CONF_NO_RAST("false")
     DRI_CONF_SECTION_END
 DRI_CONF_END;
 static const GLuint __driNConfigOptions = 16;