qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/7]  Remove pre ANSI c89 code
@ 2009-09-22 23:18 Juan Quintela
  2009-09-22 23:18 ` [Qemu-devel] [PATCH 1/7] Use proper typedef syntax Juan Quintela
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:18 UTC (permalink / raw)
  To: qemu-devel

Hi

In commemoration of the 20th anniversary of the c89 standard, this brings
qemu codebase to c89.  How do I know?

Previous to last patch adds to QEMU_CFLAGS:
  -Wold-style-declaration -Wold-style-definition

Why?
- typedef abuse for the 1st patch.  How that ever worked, I don't know.
- gcc gets picky, and you have to declare functions as:
   static inline void f(...)
   inline static void f(...)
  but
   static void inline f(...)
  gets warnings.  Just move the few functions that have the third
  format to the 1st one.
- bring alpha-dis.c and sh4-dis.c to ansi c89 function declaration.
- static + const: gcc wants you to use:
      static const
  and gives a warning for
      const static
- same for static + __thread (only 1 occurrence)
- last patch removes PARAMS() from dis-asm.h
  last users were alpha-dis.c and sh4-dis.c (do you start to see a
  pattern here).

Last one is not required, but as qemu is not going to compile in pre-c89
compiler any time soon, it is better to also apply it.

Later, Juan.


Juan Quintela (7):
  Use proper typedef syntax
  static and inline should came before the type of the functions
  Bring two last users of K&R definitions to ANSI c89
  gcc wants 1st static and then const
  __thread should be before real type
  Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  Remove PARAMS() macro

 alpha-dis.c                       |  116 ++++++++++++-------------------------
 configure                         |    1 +
 dis-asm.h                         |  102 ++++++++++++++++-----------------
 gen-icount.h                      |    2 +-
 hw/g364fb.c                       |    4 +-
 hw/pflash_cfi01.c                 |    2 +-
 hw/serial.c                       |    4 +-
 hw/sh7750.c                       |    2 +-
 hw/usb-bt.c                       |    2 +-
 hw/xen_blkif.h                    |    4 +-
 linux-user/arm/nwfpe/fpa11_cprt.c |    2 +-
 linux-user/mmap.c                 |    2 +-
 sh4-dis.c                         |   32 +++-------
 target-i386/kvm.c                 |    2 +-
 target-microblaze/translate.c     |    4 +-
 target-ppc/translate.c            |    8 +-
 16 files changed, 116 insertions(+), 173 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 1/7] Use proper typedef syntax
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
@ 2009-09-22 23:18 ` Juan Quintela
  2009-09-23  0:24   ` [Qemu-devel] " Måns Rullgård
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 2/7] static and inline should came before the type of the functions Juan Quintela
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:18 UTC (permalink / raw)
  To: qemu-devel

Why this ever compiled is a mistery to me.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/serial.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/serial.c b/hw/serial.c
index a22770f..6e8c6e1 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -98,13 +98,13 @@
 #define RECV_FIFO           1
 #define MAX_XMIT_RETRY      4

-struct SerialFIFO {
+typedef struct SerialFIFO {
     uint8_t data[UART_FIFO_LENGTH];
     uint8_t count;
     uint8_t itl;                        /* Interrupt Trigger Level */
     uint8_t tail;
     uint8_t head;
-} typedef SerialFIFO;
+} SerialFIFO;

 struct SerialState {
     uint16_t divider;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/7] static and inline should came before the type of the functions
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
  2009-09-22 23:18 ` [Qemu-devel] [PATCH 1/7] Use proper typedef syntax Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 3/7] Bring two last users of K&R definitions to ANSI c89 Juan Quintela
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 gen-icount.h                      |    2 +-
 hw/g364fb.c                       |    2 +-
 hw/pflash_cfi01.c                 |    2 +-
 hw/sh7750.c                       |    2 +-
 hw/usb-bt.c                       |    2 +-
 hw/xen_blkif.h                    |    4 ++--
 linux-user/arm/nwfpe/fpa11_cprt.c |    2 +-
 target-ppc/translate.c            |    8 ++++----
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gen-icount.h b/gen-icount.h
index d4524d6..01face2 100644
--- a/gen-icount.h
+++ b/gen-icount.h
@@ -40,7 +40,7 @@ static void gen_icount_end(TranslationBlock *tb, int num_insns)
     }
 }

-static void inline gen_io_start(void)
+static inline void gen_io_start(void)
 {
     TCGv_i32 tmp = tcg_const_i32(1);
     tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, can_do_io));
diff --git a/hw/g364fb.c b/hw/g364fb.c
index d44fcc2..88e3048 100644
--- a/hw/g364fb.c
+++ b/hw/g364fb.c
@@ -268,7 +268,7 @@ static void g364fb_update_display(void *opaque)
     qemu_irq_raise(s->irq);
 }

-static void inline g364fb_invalidate_display(void *opaque)
+static inline void g364fb_invalidate_display(void *opaque)
 {
     G364State *s = opaque;
     int i;
diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c
index 6ba496e..dfdced9 100644
--- a/hw/pflash_cfi01.c
+++ b/hw/pflash_cfi01.c
@@ -195,7 +195,7 @@ static void pflash_update(pflash_t *pfl, int offset,
     }
 }

-static void inline pflash_data_write(pflash_t *pfl, target_phys_addr_t offset,
+static inline void pflash_data_write(pflash_t *pfl, target_phys_addr_t offset,
                           uint32_t value, int width)
 {
     uint8_t *p = pfl->storage;
diff --git a/hw/sh7750.c b/hw/sh7750.c
index cf9cf16..933bbc0 100644
--- a/hw/sh7750.c
+++ b/hw/sh7750.c
@@ -69,7 +69,7 @@ typedef struct SH7750State {
     struct intc_desc intc;
 } SH7750State;

-static int inline has_bcr3_and_bcr4(SH7750State * s)
+static inline int has_bcr3_and_bcr4(SH7750State * s)
 {
 	return (s->cpu->features & SH_FEATURE_BCR3_AND_BCR4);
 }
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 4c60d42..70fd4dd 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -363,7 +363,7 @@ static inline int usb_bt_fifo_dequeue(struct usb_hci_in_fifo_s *fifo,
     return len;
 }

-static void inline usb_bt_fifo_out_enqueue(struct USBBtState *s,
+static inline void usb_bt_fifo_out_enqueue(struct USBBtState *s,
                 struct usb_hci_out_fifo_s *fifo,
                 void (*send)(struct HCIInfo *, const uint8_t *, int),
                 int (*complete)(const uint8_t *, int),
diff --git a/hw/xen_blkif.h b/hw/xen_blkif.h
index 738b8fe..c0f4136 100644
--- a/hw/xen_blkif.h
+++ b/hw/xen_blkif.h
@@ -70,7 +70,7 @@ enum blkif_protocol {
 	BLKIF_PROTOCOL_X86_64 = 3,
 };

-static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src)
+static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_request_t *src)
 {
 	int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST;

@@ -85,7 +85,7 @@ static void inline blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque
 		dst->seg[i] = src->seg[i];
 }

-static void inline blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src)
+static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_request_t *src)
 {
 	int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST;

diff --git a/linux-user/arm/nwfpe/fpa11_cprt.c b/linux-user/arm/nwfpe/fpa11_cprt.c
index fafa120..c80b124 100644
--- a/linux-user/arm/nwfpe/fpa11_cprt.c
+++ b/linux-user/arm/nwfpe/fpa11_cprt.c
@@ -147,7 +147,7 @@ unsigned int PerformFIX(const unsigned int opcode)
 }


-static unsigned int __inline__
+static __inline unsigned int
 PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
 {
    FPA11 *fpa11 = GET_FPA11();
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index c8e8b6a..8844ad2 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -2814,7 +2814,7 @@ static void gen_std(DisasContext *ctx)
 #endif
 /***                Integer load and store with byte reverse               ***/
 /* lhbrx */
-static void inline gen_qemu_ld16ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
+static inline void gen_qemu_ld16ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
 {
     tcg_gen_qemu_ld16u(arg1, arg2, ctx->mem_idx);
     if (likely(!ctx->le_mode)) {
@@ -2824,7 +2824,7 @@ static void inline gen_qemu_ld16ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
 GEN_LDX(lhbr, ld16ur, 0x16, 0x18, PPC_INTEGER);

 /* lwbrx */
-static void inline gen_qemu_ld32ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
+static inline void gen_qemu_ld32ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
 {
     tcg_gen_qemu_ld32u(arg1, arg2, ctx->mem_idx);
     if (likely(!ctx->le_mode)) {
@@ -2834,7 +2834,7 @@ static void inline gen_qemu_ld32ur(DisasContext *ctx, TCGv arg1, TCGv arg2)
 GEN_LDX(lwbr, ld32ur, 0x16, 0x10, PPC_INTEGER);

 /* sthbrx */
-static void inline gen_qemu_st16r(DisasContext *ctx, TCGv arg1, TCGv arg2)
+static inline void gen_qemu_st16r(DisasContext *ctx, TCGv arg1, TCGv arg2)
 {
     if (likely(!ctx->le_mode)) {
         TCGv t0 = tcg_temp_new();
@@ -2849,7 +2849,7 @@ static void inline gen_qemu_st16r(DisasContext *ctx, TCGv arg1, TCGv arg2)
 GEN_STX(sthbr, st16r, 0x16, 0x1C, PPC_INTEGER);

 /* stwbrx */
-static void inline gen_qemu_st32r(DisasContext *ctx, TCGv arg1, TCGv arg2)
+static inline void gen_qemu_st32r(DisasContext *ctx, TCGv arg1, TCGv arg2)
 {
     if (likely(!ctx->le_mode)) {
         TCGv t0 = tcg_temp_new();
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 3/7] Bring two last users of K&R definitions to ANSI c89
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
  2009-09-22 23:18 ` [Qemu-devel] [PATCH 1/7] Use proper typedef syntax Juan Quintela
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 2/7] static and inline should came before the type of the functions Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 4/7] gcc wants 1st static and then const Juan Quintela
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 alpha-dis.c |   76 +++++++++++++---------------------------------------------
 sh4-dis.c   |   24 ++++--------------
 2 files changed, 23 insertions(+), 77 deletions(-)

diff --git a/alpha-dis.c b/alpha-dis.c
index 097f06b..2f67c76 100644
--- a/alpha-dis.c
+++ b/alpha-dis.c
@@ -434,18 +434,13 @@ const unsigned alpha_num_operands = sizeof(alpha_operands)/sizeof(*alpha_operand

 /*ARGSUSED*/
 static unsigned
-insert_rba(insn, value, errmsg)
-     unsigned insn;
-     int value ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
+insert_rba(unsigned insn, int value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 21) & 0x1f) << 16);
 }

 static int
-extract_rba(insn, invalid)
-     unsigned insn;
-     int *invalid;
+extract_rba(unsigned insn, int *invalid)
 {
   if (invalid != (int *) NULL
       && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
@@ -458,18 +453,13 @@ extract_rba(insn, invalid)

 /*ARGSUSED*/
 static unsigned
-insert_rca(insn, value, errmsg)
-     unsigned insn;
-     int value ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
+insert_rca(unsigned insn, int value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((insn >> 21) & 0x1f);
 }

 static int
-extract_rca(insn, invalid)
-     unsigned insn;
-     int *invalid;
+extract_rca(unsigned insn, int *invalid)
 {
   if (invalid != (int *) NULL
       && ((insn >> 21) & 0x1f) != (insn & 0x1f))
@@ -482,18 +472,13 @@ extract_rca(insn, invalid)

 /*ARGSUSED*/
 static unsigned
-insert_za(insn, value, errmsg)
-     unsigned insn;
-     int value ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
+insert_za(unsigned insn, int value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (31 << 21);
 }

 static int
-extract_za(insn, invalid)
-     unsigned insn;
-     int *invalid;
+extract_za(unsigned insn, int *invalid)
 {
   if (invalid != (int *) NULL && ((insn >> 21) & 0x1f) != 31)
     *invalid = 1;
@@ -502,18 +487,13 @@ extract_za(insn, invalid)

 /*ARGSUSED*/
 static unsigned
-insert_zb(insn, value, errmsg)
-     unsigned insn;
-     int value ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
+insert_zb(unsigned insn, int value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (31 << 16);
 }

 static int
-extract_zb(insn, invalid)
-     unsigned insn;
-     int *invalid;
+extract_zb(unsigned insn, int *invalid)
 {
   if (invalid != (int *) NULL && ((insn >> 16) & 0x1f) != 31)
     *invalid = 1;
@@ -522,18 +502,13 @@ extract_zb(insn, invalid)

 /*ARGSUSED*/
 static unsigned
-insert_zc(insn, value, errmsg)
-     unsigned insn;
-     int value ATTRIBUTE_UNUSED;
-     const char **errmsg ATTRIBUTE_UNUSED;
+insert_zc(unsigned insn, int value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | 31;
 }

 static int
-extract_zc(insn, invalid)
-     unsigned insn;
-     int *invalid;
+extract_zc(unsigned insn, int *invalid)
 {
   if (invalid != (int *) NULL && (insn & 0x1f) != 31)
     *invalid = 1;
@@ -544,10 +519,7 @@ extract_zc(insn, invalid)
 /* The displacement field of a Branch format insn.  */

 static unsigned
-insert_bdisp(insn, value, errmsg)
-     unsigned insn;
-     int value;
-     const char **errmsg;
+insert_bdisp(unsigned insn, int value, const char **errmsg)
 {
   if (errmsg != (const char **)NULL && (value & 3))
     *errmsg = _("branch operand unaligned");
@@ -556,9 +528,7 @@ insert_bdisp(insn, value, errmsg)

 /*ARGSUSED*/
 static int
-extract_bdisp(insn, invalid)
-     unsigned insn;
-     int *invalid ATTRIBUTE_UNUSED;
+extract_bdisp(unsigned insn, int *invalid ATTRIBUTE_UNUSED)
 {
   return 4 * (((insn & 0x1FFFFF) ^ 0x100000) - 0x100000);
 }
@@ -567,10 +537,7 @@ extract_bdisp(insn, invalid)
 /* The hint field of a JMP/JSR insn.  */

 static unsigned
-insert_jhint(insn, value, errmsg)
-     unsigned insn;
-     int value;
-     const char **errmsg;
+insert_jhint(unsigned insn, int value, const char **errmsg)
 {
   if (errmsg != (const char **)NULL && (value & 3))
     *errmsg = _("jump hint unaligned");
@@ -579,9 +546,7 @@ insert_jhint(insn, value, errmsg)

 /*ARGSUSED*/
 static int
-extract_jhint(insn, invalid)
-     unsigned insn;
-     int *invalid ATTRIBUTE_UNUSED;
+extract_jhint(unsigned insn, int *invalid ATTRIBUTE_UNUSED)
 {
   return 4 * (((insn & 0x3FFF) ^ 0x2000) - 0x2000);
 }
@@ -589,10 +554,7 @@ extract_jhint(insn, invalid)
 /* The hint field of an EV6 HW_JMP/JSR insn.  */

 static unsigned
-insert_ev6hwjhint(insn, value, errmsg)
-     unsigned insn;
-     int value;
-     const char **errmsg;
+insert_ev6hwjhint(unsigned insn, int value, const char **errmsg)
 {
   if (errmsg != (const char **)NULL && (value & 3))
     *errmsg = _("jump hint unaligned");
@@ -601,9 +563,7 @@ insert_ev6hwjhint(insn, value, errmsg)

 /*ARGSUSED*/
 static int
-extract_ev6hwjhint(insn, invalid)
-     unsigned insn;
-     int *invalid ATTRIBUTE_UNUSED;
+extract_ev6hwjhint(unsigned insn, int *invalid ATTRIBUTE_UNUSED)
 {
   return 4 * (((insn & 0x1FFF) ^ 0x1000) - 0x1000);
 }
@@ -1804,9 +1764,7 @@ static const char * const vms_regnames[64] = {
 /* Disassemble Alpha instructions.  */

 int
-print_insn_alpha (memaddr, info)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
+print_insn_alpha (bfd_vma memaddr, struct disassemble_info *info)
 {
   static const struct alpha_opcode *opcode_index[AXP_NOPS+1];
   const char * const * regnames;
diff --git a/sh4-dis.c b/sh4-dis.c
index d183176..a9ed5b2 100644
--- a/sh4-dis.c
+++ b/sh4-dis.c
@@ -1170,11 +1170,8 @@ static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *));
 static void print_insn_ppi PARAMS ((int, struct disassemble_info *));

 static void
-print_movxy (op, rn, rm, fprintf_fn, stream)
-     const sh_opcode_info *op;
-     int rn, rm;
-     fprintf_ftype fprintf_fn;
-     void *stream;
+print_movxy (const sh_opcode_info *op, int rn, int rm,
+	     fprintf_ftype fprintf_fn, void *stream)
 {
   int n;

@@ -1248,9 +1245,7 @@ print_movxy (op, rn, rm, fprintf_fn, stream)
    Return nonzero if a field b of a parallel processing insns follows.  */

 static void
-print_insn_ddt (insn, info)
-     int insn;
-     struct disassemble_info *info;
+print_insn_ddt (int insn, struct disassemble_info *info)
 {
   fprintf_ftype fprintf_fn = info->fprintf_func;
   void *stream = info->stream;
@@ -1337,10 +1332,7 @@ print_insn_ddt (insn, info)
 }

 static void
-print_dsp_reg (rm, fprintf_fn, stream)
-     int rm;
-     fprintf_ftype fprintf_fn;
-     void *stream;
+print_dsp_reg (int rm, fprintf_ftype fprintf_fn, void *stream)
 {
   switch (rm)
     {
@@ -1381,9 +1373,7 @@ print_dsp_reg (rm, fprintf_fn, stream)
 }

 static void
-print_insn_ppi (field_b, info)
-     int field_b;
-     struct disassemble_info *info;
+print_insn_ppi (int field_b, struct disassemble_info *info)
 {
   static const char *sx_tab[] = { "x0", "x1", "a0", "a1" };
   static const char *sy_tab[] = { "y0", "y1", "m0", "m1" };
@@ -1528,9 +1518,7 @@ print_insn_ppi (field_b, info)
 /* FIXME mvs: movx insns print as ".word 0x%03x", insn & 0xfff
    (ie. the upper nibble is missing).  */
 int
-print_insn_sh (memaddr, info)
-     bfd_vma memaddr;
-     struct disassemble_info *info;
+print_insn_sh (bfd_vma memaddr, struct disassemble_info *info)
 {
   fprintf_ftype fprintf_fn = info->fprintf_func;
   void *stream = info->stream;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 4/7] gcc wants 1st static and then const
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
                   ` (2 preceding siblings ...)
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 3/7] Bring two last users of K&R definitions to ANSI c89 Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 5/7] __thread should be before real type Juan Quintela
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/g364fb.c                   |    2 +-
 target-i386/kvm.c             |    2 +-
 target-microblaze/translate.c |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/g364fb.c b/hw/g364fb.c
index 88e3048..d1d2c12 100644
--- a/hw/g364fb.c
+++ b/hw/g364fb.c
@@ -396,7 +396,7 @@ static uint32_t g364fb_ctrl_readb(void *opaque, target_phys_addr_t addr)

 static void g364fb_update_depth(G364State *s)
 {
-    const static int depths[8] = { 1, 2, 4, 8, 15, 16, 0 };
+    static const int depths[8] = { 1, 2, 4, 8, 15, 16, 0 };
     s->depth = depths[(s->ctla & 0x00700000) >> 20];
 }

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index cab9fcc..7010999 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -790,7 +790,7 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
 #ifdef KVM_CAP_SET_GUEST_DEBUG
 int kvm_arch_insert_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)
 {
-    const static uint8_t int3 = 0xcc;
+    static const uint8_t int3 = 0xcc;

     if (cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 0) ||
         cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&int3, 1, 1))
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index dfeb8ae..e91ea39 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -91,7 +91,7 @@ typedef struct DisasContext {
     int singlestep_enabled;
 } DisasContext;

-const static char *regnames[] =
+static const char *regnames[] =
 {
     "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
     "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -99,7 +99,7 @@ const static char *regnames[] =
     "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
 };

-const static char *special_regnames[] =
+static const char *special_regnames[] =
 {
     "rpc", "rmsr", "sr2", "sr3", "sr4", "sr5", "sr6", "sr7",
     "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 5/7] __thread should be before real type
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
                   ` (3 preceding siblings ...)
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 4/7] gcc wants 1st static and then const Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS Juan Quintela
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 linux-user/mmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 07ce051..144fb7c 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -35,7 +35,7 @@

 #if defined(CONFIG_USE_NPTL)
 static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
-static int __thread mmap_lock_count;
+static __thread int mmap_lock_count;

 void mmap_lock(void)
 {
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
                   ` (4 preceding siblings ...)
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 5/7] __thread should be before real type Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-23  8:48   ` Laurent Desnogues
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 7/7] Remove PARAMS() macro Juan Quintela
  2009-09-23 16:11 ` [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Markus Armbruster
  7 siblings, 1 reply; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel

ANSI c89 has been with us for a while.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 62dccd2..81b9ba8 100755
--- a/configure
+++ b/configure
@@ -1648,6 +1648,7 @@ if test "$debug" = "no" ; then
 fi
 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wold-style-declaration -Wold-style-definition $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
 QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
 QEMU_CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $QEMU_CFLAGS"
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 7/7] Remove PARAMS() macro
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
                   ` (5 preceding siblings ...)
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS Juan Quintela
@ 2009-09-22 23:19 ` Juan Quintela
  2009-09-23 16:11 ` [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Markus Armbruster
  7 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-22 23:19 UTC (permalink / raw)
  To: qemu-devel

Only two disassemblers (alpha and sh4) were still using it. Just remove its
use there, and its aparations in dis-asm.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 alpha-dis.c |   40 +++++++++++-----------
 dis-asm.h   |  102 ++++++++++++++++++++++++++++------------------------------
 sh4-dis.c   |    8 ++--
 3 files changed, 73 insertions(+), 77 deletions(-)

diff --git a/alpha-dis.c b/alpha-dis.c
index 2f67c76..895d74d 100644
--- a/alpha-dis.c
+++ b/alpha-dis.c
@@ -108,8 +108,8 @@ struct alpha_operand
      string (the operand will be inserted in any case).  If the
      operand value is legal, *ERRMSG will be unchanged (most operands
      can accept any value).  */
-  unsigned (*insert) PARAMS ((unsigned instruction, int op,
-			      const char **errmsg));
+  unsigned (*insert) (unsigned instruction, int op,
+                      const char **errmsg);

   /* Extraction function.  This is used by the disassembler.  To
      extract this operand type from an instruction, check this field.
@@ -128,7 +128,7 @@ struct alpha_operand
      non-zero if this operand type can not actually be extracted from
      this operand (i.e., the instruction does not match).  If the
      operand is valid, *INVALID will not be changed.  */
-  int (*extract) PARAMS ((unsigned instruction, int *invalid));
+  int (*extract) (unsigned instruction, int *invalid);
 };

 /* Elements in the table are retrieved by indexing with values from
@@ -273,23 +273,23 @@ enum bfd_reloc_code_real {
 \f

 /* Local insertion and extraction functions */

-static unsigned insert_rba PARAMS((unsigned, int, const char **));
-static unsigned insert_rca PARAMS((unsigned, int, const char **));
-static unsigned insert_za PARAMS((unsigned, int, const char **));
-static unsigned insert_zb PARAMS((unsigned, int, const char **));
-static unsigned insert_zc PARAMS((unsigned, int, const char **));
-static unsigned insert_bdisp PARAMS((unsigned, int, const char **));
-static unsigned insert_jhint PARAMS((unsigned, int, const char **));
-static unsigned insert_ev6hwjhint PARAMS((unsigned, int, const char **));
-
-static int extract_rba PARAMS((unsigned, int *));
-static int extract_rca PARAMS((unsigned, int *));
-static int extract_za PARAMS((unsigned, int *));
-static int extract_zb PARAMS((unsigned, int *));
-static int extract_zc PARAMS((unsigned, int *));
-static int extract_bdisp PARAMS((unsigned, int *));
-static int extract_jhint PARAMS((unsigned, int *));
-static int extract_ev6hwjhint PARAMS((unsigned, int *));
+static unsigned insert_rba (unsigned, int, const char **);
+static unsigned insert_rca (unsigned, int, const char **);
+static unsigned insert_za (unsigned, int, const char **);
+static unsigned insert_zb (unsigned, int, const char **);
+static unsigned insert_zc (unsigned, int, const char **);
+static unsigned insert_bdisp (unsigned, int, const char **);
+static unsigned insert_jhint (unsigned, int, const char **);
+static unsigned insert_ev6hwjhint (unsigned, int, const char **);
+
+static int extract_rba (unsigned, int *);
+static int extract_rca (unsigned, int *);
+static int extract_za (unsigned, int *);
+static int extract_zb (unsigned, int *);
+static int extract_zc (unsigned, int *);
+static int extract_bdisp (unsigned, int *);
+static int extract_jhint (unsigned, int *);
+static int extract_ev6hwjhint (unsigned, int *);

 \f

 /* The operands table  */
diff --git a/dis-asm.h b/dis-asm.h
index 251c490..1d8f4bd 100644
--- a/dis-asm.h
+++ b/dis-asm.h
@@ -14,7 +14,6 @@
 #include <string.h>
 #include <inttypes.h>

-#define PARAMS(x) x
 typedef void *PTR;
 typedef uint64_t bfd_vma;
 typedef int64_t bfd_signed_vma;
@@ -234,7 +233,7 @@ typedef struct symbol_cache_entry
     } udata;
 } asymbol;

-typedef int (*fprintf_ftype) PARAMS((FILE*, const char*, ...));
+typedef int (*fprintf_ftype) (FILE*, const char*, ...);

 enum dis_insn_type {
   dis_noninsn,			/* Not a valid instruction */
@@ -296,19 +295,19 @@ typedef struct disassemble_info {
      INFO is a pointer to this struct.
      Returns an errno value or 0 for success.  */
   int (*read_memory_func)
-    PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, int length,
-	     struct disassemble_info *info));
+    (bfd_vma memaddr, bfd_byte *myaddr, int length,
+	     struct disassemble_info *info);

   /* Function which should be called if we get an error that we can't
      recover from.  STATUS is the errno value from read_memory_func and
      MEMADDR is the address that we were trying to read.  INFO is a
      pointer to this struct.  */
   void (*memory_error_func)
-    PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info));
+    (int status, bfd_vma memaddr, struct disassemble_info *info);

   /* Function called to print ADDR.  */
   void (*print_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info *info));
+    (bfd_vma addr, struct disassemble_info *info);

   /* Function called to determine if there is a symbol at the given ADDR.
      If there is, the function returns 1, otherwise it returns 0.
@@ -318,7 +317,7 @@ typedef struct disassemble_info {
      address, (normally because there is a symbol associated with
      that address), but sometimes we want to mask out the overlay bits.  */
   int (* symbol_at_address_func)
-    PARAMS ((bfd_vma addr, struct disassemble_info * info));
+    (bfd_vma addr, struct disassemble_info * info);

   /* These are for buffer_read_memory.  */
   bfd_byte *buffer;
@@ -363,49 +362,48 @@ typedef struct disassemble_info {
 \f

 /* Standard disassemblers.  Disassemble one instruction at the given
    target address.  Return number of bytes processed.  */
-typedef int (*disassembler_ftype)
-     PARAMS((bfd_vma, disassemble_info *));
-
-extern int print_insn_big_mips		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_mips	PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i386		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m68k		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8001		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_z8002		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300h		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8300s		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_h8500		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_alpha		PARAMS ((bfd_vma, disassemble_info*));
-extern disassembler_ftype arc_get_disassembler PARAMS ((int, int));
-extern int print_insn_arm		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sparc		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_a29k		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_a29k	PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_i960		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sh		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_shl		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_hppa		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m32r		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_m88k		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10200		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_mn10300		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ns32k		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_big_powerpc	PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_little_powerpc	PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_rs6000		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_w65		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d10v		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_v850		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_tic30		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_ppc		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_s390		PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_crisv32           PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_microblaze        PARAMS ((bfd_vma, disassemble_info*));
+typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);
+
+extern int print_insn_big_mips		(bfd_vma, disassemble_info*);
+extern int print_insn_little_mips	(bfd_vma, disassemble_info*);
+extern int print_insn_i386		(bfd_vma, disassemble_info*);
+extern int print_insn_m68k		(bfd_vma, disassemble_info*);
+extern int print_insn_z8001		(bfd_vma, disassemble_info*);
+extern int print_insn_z8002		(bfd_vma, disassemble_info*);
+extern int print_insn_h8300		(bfd_vma, disassemble_info*);
+extern int print_insn_h8300h		(bfd_vma, disassemble_info*);
+extern int print_insn_h8300s		(bfd_vma, disassemble_info*);
+extern int print_insn_h8500		(bfd_vma, disassemble_info*);
+extern int print_insn_alpha		(bfd_vma, disassemble_info*);
+extern disassembler_ftype arc_get_disassembler (int, int);
+extern int print_insn_arm		(bfd_vma, disassemble_info*);
+extern int print_insn_sparc		(bfd_vma, disassemble_info*);
+extern int print_insn_big_a29k		(bfd_vma, disassemble_info*);
+extern int print_insn_little_a29k	(bfd_vma, disassemble_info*);
+extern int print_insn_i960		(bfd_vma, disassemble_info*);
+extern int print_insn_sh		(bfd_vma, disassemble_info*);
+extern int print_insn_shl		(bfd_vma, disassemble_info*);
+extern int print_insn_hppa		(bfd_vma, disassemble_info*);
+extern int print_insn_m32r		(bfd_vma, disassemble_info*);
+extern int print_insn_m88k		(bfd_vma, disassemble_info*);
+extern int print_insn_mn10200		(bfd_vma, disassemble_info*);
+extern int print_insn_mn10300		(bfd_vma, disassemble_info*);
+extern int print_insn_ns32k		(bfd_vma, disassemble_info*);
+extern int print_insn_big_powerpc	(bfd_vma, disassemble_info*);
+extern int print_insn_little_powerpc	(bfd_vma, disassemble_info*);
+extern int print_insn_rs6000		(bfd_vma, disassemble_info*);
+extern int print_insn_w65		(bfd_vma, disassemble_info*);
+extern int print_insn_d10v		(bfd_vma, disassemble_info*);
+extern int print_insn_v850		(bfd_vma, disassemble_info*);
+extern int print_insn_tic30		(bfd_vma, disassemble_info*);
+extern int print_insn_ppc		(bfd_vma, disassemble_info*);
+extern int print_insn_s390		(bfd_vma, disassemble_info*);
+extern int print_insn_crisv32           (bfd_vma, disassemble_info*);
+extern int print_insn_microblaze        (bfd_vma, disassemble_info*);

 #if 0
 /* Fetch the disassembler for a given BFD, if that support is available.  */
-extern disassembler_ftype disassembler	PARAMS ((bfd *));
+extern disassembler_ftype disassembler	(bfd *);
 #endif

 \f

@@ -415,22 +413,20 @@ extern disassembler_ftype disassembler	PARAMS ((bfd *));
 /* Here is a function which callers may wish to use for read_memory_func.
    It gets bytes from a buffer.  */
 extern int buffer_read_memory
-  PARAMS ((bfd_vma, bfd_byte *, int, struct disassemble_info *));
+  (bfd_vma, bfd_byte *, int, struct disassemble_info *);

 /* This function goes with buffer_read_memory.
    It prints a message using info->fprintf_func and info->stream.  */
-extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
+extern void perror_memory (int, bfd_vma, struct disassemble_info *);


 /* Just print the address in hex.  This is included for completeness even
    though both GDB and objdump provide their own (to print symbolic
    addresses).  */
-extern void generic_print_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
+extern void generic_print_address (bfd_vma, struct disassemble_info *);

 /* Always true.  */
-extern int generic_symbol_at_address
-  PARAMS ((bfd_vma, struct disassemble_info *));
+extern int generic_symbol_at_address (bfd_vma, struct disassemble_info *);

 /* Macro to initialize a disassemble_info struct.  This should be called
    by all applications creating such a struct.  */
diff --git a/sh4-dis.c b/sh4-dis.c
index a9ed5b2..a502a61 100644
--- a/sh4-dis.c
+++ b/sh4-dis.c
@@ -1164,10 +1164,10 @@ const sh_opcode_info sh_table[] =
 #endif

 static void print_movxy
-  PARAMS ((const sh_opcode_info *, int, int, fprintf_ftype, void *));
-static void print_insn_ddt PARAMS ((int, struct disassemble_info *));
-static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *));
-static void print_insn_ppi PARAMS ((int, struct disassemble_info *));
+  (const sh_opcode_info *, int, int, fprintf_ftype, void *);
+static void print_insn_ddt (int, struct disassemble_info *);
+static void print_dsp_reg (int, fprintf_ftype, void *);
+static void print_insn_ppi (int, struct disassemble_info *);

 static void
 print_movxy (const sh_opcode_info *op, int rn, int rm,
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] Re: [PATCH 1/7] Use proper typedef syntax
  2009-09-22 23:18 ` [Qemu-devel] [PATCH 1/7] Use proper typedef syntax Juan Quintela
@ 2009-09-23  0:24   ` Måns Rullgård
  0 siblings, 0 replies; 14+ messages in thread
From: Måns Rullgård @ 2009-09-23  0:24 UTC (permalink / raw)
  To: qemu-devel

Juan Quintela <quintela@redhat.com> writes:

> Why this ever compiled is a mistery to me.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/serial.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/serial.c b/hw/serial.c
> index a22770f..6e8c6e1 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -98,13 +98,13 @@
>  #define RECV_FIFO           1
>  #define MAX_XMIT_RETRY      4
>
> -struct SerialFIFO {
> +typedef struct SerialFIFO {
>      uint8_t data[UART_FIFO_LENGTH];
>      uint8_t count;
>      uint8_t itl;                        /* Interrupt Trigger Level */
>      uint8_t tail;
>      uint8_t head;
> -} typedef SerialFIFO;
> +} SerialFIFO;

Syntactically, typedef is a storage class specifier just like static
or extern, and the entire struct { } block is type specifier like int
or float.  The order of type specifiers and storage class specifiers
is not important.  The above construct is thus perfectly valid, albeit
unusual, C code.

That said, I'm all in favour of changing it to the more common style.

-- 
Måns Rullgård
mans@mansr.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS Juan Quintela
@ 2009-09-23  8:48   ` Laurent Desnogues
  2009-09-23 16:09     ` Markus Armbruster
  0 siblings, 1 reply; 14+ messages in thread
From: Laurent Desnogues @ 2009-09-23  8:48 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

On Wed, Sep 23, 2009 at 1:19 AM, Juan Quintela <quintela@redhat.com> wrote:
> ANSI c89 has been with us for a while.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  configure |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 62dccd2..81b9ba8 100755
> --- a/configure
> +++ b/configure
> @@ -1648,6 +1648,7 @@ if test "$debug" = "no" ; then
>  fi
>  QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
> +QEMU_CFLAGS="-Wold-style-declaration -Wold-style-definition $QEMU_CFLAGS"

Some older versions of gcc don't handle -Wold-style-declaration.
For instance gcc 4.1.2.


Laurent

>  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
>  QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
>  QEMU_CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $QEMU_CFLAGS"
> --
> 1.6.2.5
>
>
>
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  2009-09-23  8:48   ` Laurent Desnogues
@ 2009-09-23 16:09     ` Markus Armbruster
  2009-09-23 17:16       ` Blue Swirl
  0 siblings, 1 reply; 14+ messages in thread
From: Markus Armbruster @ 2009-09-23 16:09 UTC (permalink / raw)
  To: Laurent Desnogues; +Cc: qemu-devel, Juan Quintela

Laurent Desnogues <laurent.desnogues@gmail.com> writes:

> On Wed, Sep 23, 2009 at 1:19 AM, Juan Quintela <quintela@redhat.com> wrote:
>> ANSI c89 has been with us for a while.
>>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  configure |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 62dccd2..81b9ba8 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1648,6 +1648,7 @@ if test "$debug" = "no" ; then
>>  fi
>>  QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>> +QEMU_CFLAGS="-Wold-style-declaration -Wold-style-definition $QEMU_CFLAGS"
>
> Some older versions of gcc don't handle -Wold-style-declaration.
> For instance gcc 4.1.2.

Pretty old, do we want to support it?  If yes, make configure detect
whether the warning works?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 0/7]  Remove pre ANSI c89 code
  2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
                   ` (6 preceding siblings ...)
  2009-09-22 23:19 ` [Qemu-devel] [PATCH 7/7] Remove PARAMS() macro Juan Quintela
@ 2009-09-23 16:11 ` Markus Armbruster
  7 siblings, 0 replies; 14+ messages in thread
From: Markus Armbruster @ 2009-09-23 16:11 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

Juan Quintela <quintela@redhat.com> writes:

> Hi
>
> In commemoration of the 20th anniversary of the c89 standard, this brings
> qemu codebase to c89.  How do I know?
>
> Previous to last patch adds to QEMU_CFLAGS:
>   -Wold-style-declaration -Wold-style-definition
>
> Why?
> - typedef abuse for the 1st patch.  How that ever worked, I don't know.
> - gcc gets picky, and you have to declare functions as:
>    static inline void f(...)
>    inline static void f(...)
>   but
>    static void inline f(...)
>   gets warnings.  Just move the few functions that have the third
>   format to the 1st one.
> - bring alpha-dis.c and sh4-dis.c to ansi c89 function declaration.
> - static + const: gcc wants you to use:
>       static const
>   and gives a warning for
>       const static
> - same for static + __thread (only 1 occurrence)
> - last patch removes PARAMS() from dis-asm.h
>   last users were alpha-dis.c and sh4-dis.c (do you start to see a
>   pattern here).
>
> Last one is not required, but as qemu is not going to compile in pre-c89
> compiler any time soon, it is better to also apply it.
>
> Later, Juan.

None of these are incorrect C89, just terribly old-fashioned and/or bad
style.  Good cleanup.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  2009-09-23 16:09     ` Markus Armbruster
@ 2009-09-23 17:16       ` Blue Swirl
  2009-09-29 23:15         ` [Qemu-devel] " Juan Quintela
  0 siblings, 1 reply; 14+ messages in thread
From: Blue Swirl @ 2009-09-23 17:16 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Laurent Desnogues, qemu-devel, Juan Quintela

On Wed, Sep 23, 2009 at 7:09 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Laurent Desnogues <laurent.desnogues@gmail.com> writes:
>
>> On Wed, Sep 23, 2009 at 1:19 AM, Juan Quintela <quintela@redhat.com> wrote:
>>> ANSI c89 has been with us for a while.
>>>
>>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>> ---
>>>  configure |    1 +
>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 62dccd2..81b9ba8 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1648,6 +1648,7 @@ if test "$debug" = "no" ; then
>>>  fi
>>>  QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>>>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>>> +QEMU_CFLAGS="-Wold-style-declaration -Wold-style-definition $QEMU_CFLAGS"
>>
>> Some older versions of gcc don't handle -Wold-style-declaration.
>> For instance gcc 4.1.2.
>
> Pretty old, do we want to support it?  If yes, make configure detect
> whether the warning works?

Yes, OpenBSD uses 3.3.5 (propolice).

There are already similar checks for linker flags in configure, new
checks for warnings available would allow a different set of flags for
the latest and greatest GCC and the good old ones.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] Re: [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS
  2009-09-23 17:16       ` Blue Swirl
@ 2009-09-29 23:15         ` Juan Quintela
  0 siblings, 0 replies; 14+ messages in thread
From: Juan Quintela @ 2009-09-29 23:15 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Laurent Desnogues, Markus Armbruster, qemu-devel

Blue Swirl <blauwirbel@gmail.com> wrote:
> On Wed, Sep 23, 2009 at 7:09 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Laurent Desnogues <laurent.desnogues@gmail.com> writes:
>>
>>> On Wed, Sep 23, 2009 at 1:19 AM, Juan Quintela <quintela@redhat.com> wrote:
>>>> ANSI c89 has been with us for a while.
>>>>
>>>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>>> ---
>>>>  configure |    1 +
>>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 62dccd2..81b9ba8 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1648,6 +1648,7 @@ if test "$debug" = "no" ; then
>>>>  fi
>>>>  QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
>>>>  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>>>> +QEMU_CFLAGS="-Wold-style-declaration -Wold-style-definition $QEMU_CFLAGS"
>>>
>>> Some older versions of gcc don't handle -Wold-style-declaration.
>>> For instance gcc 4.1.2.
>>
>> Pretty old, do we want to support it?  If yes, make configure detect
>> whether the warning works?
>
> Yes, OpenBSD uses 3.3.5 (propolice).
>
> There are already similar checks for linker flags in configure, new
> checks for warnings available would allow a different set of flags for
> the latest and greatest GCC and the good old ones.

Fixed in new series just sent.  It detects in configure if flags exists.

Thanks for the review, Juan.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-09-29 23:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-22 23:18 [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Juan Quintela
2009-09-22 23:18 ` [Qemu-devel] [PATCH 1/7] Use proper typedef syntax Juan Quintela
2009-09-23  0:24   ` [Qemu-devel] " Måns Rullgård
2009-09-22 23:19 ` [Qemu-devel] [PATCH 2/7] static and inline should came before the type of the functions Juan Quintela
2009-09-22 23:19 ` [Qemu-devel] [PATCH 3/7] Bring two last users of K&R definitions to ANSI c89 Juan Quintela
2009-09-22 23:19 ` [Qemu-devel] [PATCH 4/7] gcc wants 1st static and then const Juan Quintela
2009-09-22 23:19 ` [Qemu-devel] [PATCH 5/7] __thread should be before real type Juan Quintela
2009-09-22 23:19 ` [Qemu-devel] [PATCH 6/7] Add -Wold-style-declaration -Wold-style-definition to QEMU_CFLAGS Juan Quintela
2009-09-23  8:48   ` Laurent Desnogues
2009-09-23 16:09     ` Markus Armbruster
2009-09-23 17:16       ` Blue Swirl
2009-09-29 23:15         ` [Qemu-devel] " Juan Quintela
2009-09-22 23:19 ` [Qemu-devel] [PATCH 7/7] Remove PARAMS() macro Juan Quintela
2009-09-23 16:11 ` [Qemu-devel] [PATCH 0/7] Remove pre ANSI c89 code Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).