This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[csl-sol210] Add "#" format specifier for cmn_err, -nolibgcc


This patch adds a "#" format specifier for the Solaris kernel cmn_err function.

It also adds a -nolibgcc switch, which is used for obscure purposes when building some Solaris system utilities. I've not yet added documentation for it, but will before (if?) it shows up on minaline.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

2004-09-24  Mark Mitchell <mark@codesourcery.com>

	* gcc/config/i386/sol2-10.h (LIBGCC_SPEC): Add support for -nolibgcc.

	* gcc/config/sol2-c.c (cmn_err_flag_specs): Add "#"
	(cmn_err_char_table): Likewise.
	(solaris_format_types): Likewise.
	* gcc/testsuite/gcc.dg/format/cmn-err-1.c: Add "#" tests.

Index: config/sol2-c.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sol2-c.c,v
retrieving revision 1.3.4.1
diff -c -5 -p -r1.3.4.1 sol2-c.c
*** config/sol2-c.c	23 Sep 2004 07:27:08 -0000	1.3.4.1
--- config/sol2-c.c	24 Sep 2004 20:15:04 -0000
*************** static const format_length_info cmn_err_
*** 41,50 ****
--- 41,51 ----
    { NULL, 0, 0, NULL, 0, 0 }
  };
  
  static const format_flag_spec cmn_err_flag_specs[] =
  {
+   { '#',  0, 0, N_("`#' flag"),        N_("the `#' cmn_err flag"),              STD_C89 },
    { 'w',  0, 0, N_("field width"),     N_("field width in printf format"),     STD_C89 },
    { 'L',  0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
    { 0, 0, 0, NULL, NULL, 0 }
  };
  
*************** static const format_char_info bitfield_s
*** 59,79 ****
  
  static const format_char_info cmn_err_char_table[] =
  {
    /* C89 conversion specifiers.  */
    { "dD",  0, STD_C89, { T89_I,   BADLEN,  BADLEN,  T89_L,   T9L_LL,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
!   { "oOxX",0, STD_C89, { T89_UI,  BADLEN,  BADLEN,  T89_UL,  T9L_ULL, BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
    { "u",   0, STD_C89, { T89_UI,  BADLEN,  BADLEN,  T89_UL,  T9L_ULL, BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
    { "c",   0, STD_C89, { T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
    { "p",   1, STD_C89, { T89_V,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w", "c",  NULL },
    { "s",   1, STD_C89, { T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "cR", NULL },
    { "b",   0, STD_C89, { T89_I,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",   "",   &bitfield_string_type },
    { NULL,  0, 0, NOLENGTHS, NULL, NULL, NULL }
  };
  
  const format_kind_info solaris_format_types[] = {
!   { "cmn_err",  cmn_err_length_specs,  cmn_err_char_table, "", NULL,
      cmn_err_flag_specs, cmn_err_flag_pairs,
      FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK,
      'w', 0, 0, 0, 'L',
      &integer_type_node, &integer_type_node
    }
--- 60,80 ----
  
  static const format_char_info cmn_err_char_table[] =
  {
    /* C89 conversion specifiers.  */
    { "dD",  0, STD_C89, { T89_I,   BADLEN,  BADLEN,  T89_L,   T9L_LL,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
!   { "oOxX",0, STD_C89, { T89_UI,  BADLEN,  BADLEN,  T89_UL,  T9L_ULL, BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w#", "",   NULL },
    { "u",   0, STD_C89, { T89_UI,  BADLEN,  BADLEN,  T89_UL,  T9L_ULL, BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
    { "c",   0, STD_C89, { T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "",   NULL },
    { "p",   1, STD_C89, { T89_V,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w", "c",  NULL },
    { "s",   1, STD_C89, { T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "w",  "cR", NULL },
    { "b",   0, STD_C89, { T89_I,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",   "",   &bitfield_string_type },
    { NULL,  0, 0, NOLENGTHS, NULL, NULL, NULL }
  };
  
  const format_kind_info solaris_format_types[] = {
!   { "cmn_err",  cmn_err_length_specs,  cmn_err_char_table, "#", NULL,
      cmn_err_flag_specs, cmn_err_flag_pairs,
      FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK,
      'w', 0, 0, 0, 'L',
      &integer_type_node, &integer_type_node
    }
Index: config/i386/sol2-10.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/Attic/sol2-10.h,v
retrieving revision 1.1.4.1
diff -c -5 -p -r1.1.4.1 sol2-10.h
*** config/i386/sol2-10.h	23 Sep 2004 07:27:10 -0000	1.1.4.1
--- config/i386/sol2-10.h	24 Sep 2004 20:15:04 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 84,93 ****
--- 84,102 ----
  #define TARGET_LD_EMULATION "%{m64:-m elf_x86_64}%{!m64:-m elf_i386} "
  #else
  #define TARGET_LD_EMULATION ""
  #endif
  
+ /* On, Solaris 2.10 some of the system utilities are built with GCC.
+    Sun does not want these utilities should not be linked with libgcc
+    because a future installation of GCC in /usr/local might then
+    result in the base system utilities picking up a new version of
+    libgcc.  */
+ #undef LIBGCC_SPEC
+ #define LIBGCC_SPEC \
+   "%{!nolibgcc:-lgcc}"
+ 
  #undef LINK_ARCH_SPEC
  #define LINK_ARCH_SPEC TARGET_LD_EMULATION \
  		       "%{m64:" LINK_ARCH64_SPEC "}%{!m64:" LINK_ARCH32_SPEC "}"
  
  #undef TARGET_ASM_NAMED_SECTION
*************** Boston, MA 02111-1307, USA.  */
*** 100,113 ****
    (TARGET_64BIT 				\
     ? ix86_return_in_memory (TYPE)		\
     : (TYPE_MODE (TYPE) == BLKmode		\
        || (VECTOR_MODE_P (TYPE_MODE (TYPE)) 	\
  	  && int_size_in_bytes (TYPE) == 8)))
- 
- /* The following can use target preprocessor macros, because it is only used
-    by crtstuff.c.  */
- 
- /* If the Solaris dynamic linker will automatically register .eh_frame_hdr
-    from the program header, we can define this to avoid duplicate
-    registration.  */
- /* #define USE_PT_GNU_EH_FRAME */
- 
--- 109,113 ----
Index: testsuite/gcc.dg/format/cmn-err-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/format/cmn-err-1.c,v
retrieving revision 1.2.16.1
diff -c -5 -p -r1.2.16.1 cmn-err-1.c
*** testsuite/gcc.dg/format/cmn-err-1.c	23 Sep 2004 07:27:23 -0000	1.2.16.1
--- testsuite/gcc.dg/format/cmn-err-1.c	24 Sep 2004 20:15:09 -0000
*************** const char *string = "foo";
*** 15,37 ****
--- 15,40 ----
  int main()
  {
    int i = 1;
    long l = 2;
    llong ll = 3;
+   float f = 4.0;
  
    cmn_err_func (0, "%s", string);
    cmn_err_func (0, "%d %D %o %O %x %X %u", i, i, i, i, i, i, i);
    cmn_err_func (0, "%ld %lD %lo %lO %lx %lX %lu", l, l, l, l, l, l, l);
    cmn_err_func (0, "%lld %llD %llo %llO %llx %llX %llu",
  		ll, ll, ll, ll, ll, ll, ll);
    cmn_err_func (0, "%b %s", i, "\01Foo", string);
    cmn_err_func (0, "%p", string);
+   cmn_err_func (0, "%#x", i);
  
    cmn_err_func (0, "%i", i);		/* { dg-error "unknown|too many" } */
    cmn_err_func (0, "%d", l);		/* { dg-error "int format, (long int|different type) arg" } */
    cmn_err_func (0, "%b");		/* { dg-error "too few" } */
    cmn_err_func (0, "%b", i);		/* { dg-error "too few" } */
    cmn_err_func (0, "%b", i, i);		/* { dg-error "is not a pointer" } */
    cmn_err_func (0, "%b", string, i);	/* { dg-error "int format, pointer arg|is not a pointer" } */
    cmn_err_func (0, "%p", 3);            /* { dg-error "is not a pointer" } */
+   cmn_err_func (0, "%#x", f);           /* { dg-error "double arg" } */
    return 0;
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]