finalise NEWS.stable
[gnulib.git] / lib / quotearg.c
index 18b788a..03fbfe7 100644 (file)
 
 /* Written by Paul Eggert <eggert@twinsun.com> */
 
+/* Without this pragma, gcc 4.7.0 20111124 mistakenly suggests that
+   the quoting_options_from_style function might be candidate for
+   attribute 'pure'  */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#endif
+
 #include <config.h>
 
 #include "quotearg.h"
 
 #define INT_BITS (sizeof (int) * CHAR_BIT)
 
-/* The attribute __pure__ was added in gcc 2.96.  */
-#undef _GL_ATTRIBUTE_PURE
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
 struct quoting_options
 {
   /* Basic quoting style.  */
@@ -113,7 +112,7 @@ clone_quoting_options (struct quoting_options *o)
 }
 
 /* Get the value of O's quoting style.  If O is null, use the default.  */
-enum quoting_style _GL_ATTRIBUTE_PURE
+enum quoting_style
 get_quoting_style (struct quoting_options *o)
 {
   return (o ? o : &default_quoting_options)->style;
@@ -173,13 +172,13 @@ set_custom_quoting (struct quoting_options *o,
 }
 
 /* Return quoting options for STYLE, with no extra quoting.  */
-static struct quoting_options
+static struct quoting_options /* NOT PURE!! */
 quoting_options_from_style (enum quoting_style style)
 {
-  struct quoting_options o;
+  struct quoting_options o = { 0 };
+  if (style == custom_quoting_style)
+    abort ();
   o.style = style;
-  o.flags = 0;
-  memset (o.quote_these_too, 0, sizeof o.quote_these_too);
   return o;
 }