Mail Archives: djgpp-workers/2011/07/30/17:40:40
OFYI, I committed the patch below to fix the unused-but-set error/warning
when trying to compile the libc repository. The patch below fixes those
cases where the warnings are treates as errors. Now it is possible again
to compile the sources using gcc 4.6.1
Regards,
Juan M. Guerrero
2011-07-30 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
* src/libc/ansi/stdio/doprnt.c: Fix unused-but-set error/warning.
* src/libc/fsext/fse_zero.c: Fix unused-but-set error/warning.
* src/utils/getconf.c: Fix unused-but-set error/warning.
Index: djgpp/src/libc/ansi/stdio/doprnt.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doprnt.c,v
retrieving revision 1.29
diff -U 5 -r1.29 doprnt.c
--- djgpp/src/libc/ansi/stdio/doprnt.c 8 Jun 2008 00:25:36 -0000 1.29
+++ djgpp/src/libc/ansi/stdio/doprnt.c 30 Jul 2011 21:04:09 -0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
@@ -19,10 +20,11 @@
#include <limits.h>
#include <stdbool.h>
#include <libc/file.h>
#include <libc/local.h>
#include <libc/ieee.h>
+#include <sys/cdefs.h>
static char decimal_point;
static char thousands_sep;
static char *grouping;
@@ -115,11 +117,11 @@
int cnt; /* return value accumulator */
int n; /* random handy integer */
char *t; /* buffer pointer */
long double _ldouble; /* double and long double precision arguments
%L.[aAeEfFgG] */
- unsigned long long _ulonglong=0; /* integer arguments %[diouxX] */
+ unsigned long long _ulonglong = 0; /* integer arguments %[diouxX] */
int base; /* base for [diouxX] conversion */
int dprec; /* decimal precision in [diouxX] */
int fieldsz; /* field size expanded by sign, etc */
int flags; /* flags as above */
int fpprec; /* `extra' floating precision in [eEfFgG] */
@@ -1321,11 +1323,11 @@
*/
const char *fmt = fmt0;
int arg_index = 0, prec_index = 0, list_index;
int ch, flags, n = index_of_arg_to_be_fetched + 1;
- unsigned long long _ulonglong; /* discard value retrieved by ARG() */
+ unsigned long long _ulonglong _ATTRIBUTE(__unused__); /* discard value retrieved by ARG() */
for (list_index = 1; list_index < n;)
{
while ((ch = *fmt) && ch != '%')
Index: djgpp/src/libc/fsext/fse_zero.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/fsext/fse_zero.c,v
retrieving revision 1.5
diff -U 5 -r1.5 fse_zero.c
--- djgpp/src/libc/fsext/fse_zero.c 8 Mar 2003 00:43:18 -0000 1.5
+++ djgpp/src/libc/fsext/fse_zero.c 30 Jul 2011 21:04:10 -0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
@@ -18,10 +19,11 @@
#include <io.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/fsext.h>
#include <sys/xdevices.h>
+#include <sys/cdefs.h>
static const char DEV_ZERO_PATH[] = "/dev/zero";
static const char DEV_FULL_PATH[] = "/dev/full";
typedef struct {
@@ -175,30 +177,30 @@
* ------------- */
static int
dev_fsext (__FSEXT_Fnumber n, int *rv, va_list args)
{
- int emul = 0; /* Emulated call? 1 => yes, 0 = no. */
- int fd = 0;
- DEV_DATA *data = NULL;
- char *filename = NULL;
- char *new_filename = NULL;
- int open_mode = 0;
- int perm = 0;
- mode_t mode = 0;
- void *buf = NULL;
- size_t buflen = 0;
- off_t offset = 0;
- offset_t lloffset = 0;
- uid_t owner = 0;
- gid_t group = 0;
- int whence = 0;
- struct stat *sbuf = NULL;
- int cmd = 0;
- int iparam = 0;
+ int emul = 0; /* Emulated call? 1 => yes, 0 = no. */
+ int fd = 0;
+ DEV_DATA *data = NULL;
+ char *filename = NULL;
+ char *new_filename = NULL;
+ int open_mode = 0;
+ int perm _ATTRIBUTE(__unused__) = 0;
+ mode_t mode _ATTRIBUTE(__unused__) = 0;
+ void *buf = NULL;
+ size_t buflen = 0;
+ off_t offset _ATTRIBUTE(__unused__) = 0;
+ offset_t lloffset _ATTRIBUTE(__unused__) = 0;
+ uid_t owner _ATTRIBUTE(__unused__) = 0;
+ gid_t group _ATTRIBUTE(__unused__) = 0;
+ int whence _ATTRIBUTE(__unused__) = 0;
+ struct stat *sbuf = NULL;
+ int cmd = 0;
+ int iparam = 0;
#ifdef DJGPP_SUPPORTS_FIONBIO_NOW
- int *piparam = NULL;
+ int *piparam = NULL;
#endif /* DJGPP_SUPPORTS_FIONBIO_NOW */
switch(n) {
default:
case __FSEXT_nop:
Index: djgpp/src/utils/getconf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/utils/getconf.c,v
retrieving revision 1.3
diff -U 5 -r1.3 getconf.c
--- djgpp/src/utils/getconf.c 13 Jul 2001 08:41:06 -0000 1.3
+++ djgpp/src/utils/getconf.c 30 Jul 2011 21:04:10 -0000
@@ -1,13 +1,15 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
#include <unistd.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <sys/cdefs.h>
#define constant_var 0
#define confstr_var 1
#define pathconf_var 2
#define sysconf_var 3
@@ -152,11 +154,11 @@
break;
}
case confstr_var:
{
- size_t buf_len, ret;
+ size_t buf_len, ret _ATTRIBUTE(__unused__);
char *buf;
buf_len = confstr(var->value, 0, 0);
if (buf_len)
{
- Raw text -