Joel Sherrill | 18 Mar 22:29 2015

wchar_t printf() format warning

Hi

I am returning to this issue. This appears to be similar to the
intptr_t issue but with wchar_t. We get a printf() warning on
targets where wchar_t is defined is defined as "long int" and
not on targets where it is "int".  This appears to be because
of a conflict in the definition of __WINT_TYPE__ and
__WCHAR_TYPE__ by gcc.  I am open to suggestions on how
to resolve this.

$ sparc-rtems4.11-gcc -dM -E - </dev/null | grep WCHAR_TYPE
#define __WCHAR_TYPE__ long int
$ i386-rtems4.11-gcc -dM -E - </dev/null | grep WCHAR_TYPE
#define __WCHAR_TYPE__ int
$ sparc-rtems4.11-gcc -dM -E - </dev/null | grep WINT_TYPE
#define __WINT_TYPE__ unsigned int
$ i386-rtems4.11-gcc -dM -E - </dev/null | grep WINT_TYPE
#define __WINT_TYPE__ unsigned int

sparc generates this warning but i386 does not:

$ sparc-rtems4.11-gcc -Wall -c wc.c
wc.c: In function 'f':
wc.c:10:3: warning: format '%lc' expects argument of type 'wint_t', but
argument 4 has type 'wchar_t' [-Wformat=]
   (void)printf("%*s%lc\n", pad, "", wc);
   ^
wc.c:10:3: warning: format '%lc' expects argument of type 'wint_t', but
argument 4 has type 'wchar_t' [-Wformat=]

(Continue reading)

Joel Sherrill | 18 Mar 21:19 2015

What to do with newlib git mirror?

Hi

Now that newlib is actually in git, shouldn't this be removed?

https://sourceware.org/git/?p=newlib.git;a=summary

--

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill <at> OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

Joel Sherrill | 15 Mar 23:02 2015

h8300, m32c and PRIuPTR

Hi

Fighting through more printf() format warnings. This code
compiles without warning on all 18 RTEMS targets with
default arguments but has warnings on a h8300 and m32c
when certain CPU model CFLAGS are added. From a quick
check of the impact of adding the -mcpu=m32cm argument,
it is changing the sizeof(ptr) from 2 to 4 bytes.

==================
#include <stdio.h>
#include <inttypes.h>

void f( uintptr_t x)
{
   printf( "%" PRIuPTR "\n", x );
}
==================

The warning is:

f.c:6:3: warning: format '%u' expects argument of type 'unsigned int', 
but argument 2 has type 'uintptr_t' [-Wformat=]
    printf( "%" PRIuPTR "\n", x );
    ^

Various compiler options that trigger the warning:

h8300-rtems4.11-gcc  -Wall -c f.c <== no warning

(Continue reading)

Joel Sherrill | 13 Mar 19:12 2015

inconsistent printf() warning printing size_t

Hi

This code gives a warning on some targets and not on others.
Specifically, it gives a warning where size_t is long unsigned int
but not unsigned int. If you use %ld, it inverts when the warning
occurs. Any suggestions on how to portably print a size_t and
not get a warning?

==============
#include <stdio.h>

void f( size_t x)
{
  printf( "%d\n", x );
}
===============

This script is used to do the analysis:

===================
for t in arm-rtems4.11 avr-rtems4.11 bfin-rtems4.11 h8300-rtems4.11 \
  i386-rtems4.11 lm32-rtems4.11 m32c-rtems4.11 m32r-rtems4.11 \
  m68k-rtems4.11 mips-rtems4.11 nios2-rtems4.11 \
  powerpc-rtems4.11 sh-rtems4.11 sparc64-rtems4.11 sparc-rtems4.11 \
  v850-rtems4.11
do
  echo === ${t}
  ${t}-gcc -dM -E - </dev/null | grep UINTPTR_TYPE
  ${t}-gcc -Wall -Wextra -c f.c
done
(Continue reading)

Yaakov Selkowitz | 13 Mar 17:25 2015
Picon

[PATCH] string: add GNU basename(3)

* libc/include/libgen.h (_BASENAME_DEFINED): Define.
* libc/include/string.h (basename): Declare.
* libc/string/Makefile.am (ELIX_4_SOURCES): Add gnu_basename.c.
* libc/string/Makefile.in: Regenerate.
* libc/string/gnu_basename.c: New file.
---
Patch for Cygwin to follow.

 newlib/libc/include/libgen.h      |  1 +
 newlib/libc/include/string.h      | 14 ++++++++++++++
 newlib/libc/string/Makefile.am    |  1 +
 newlib/libc/string/Makefile.in    | 13 +++++++++++--
 newlib/libc/string/gnu_basename.c | 32 ++++++++++++++++++++++++++++++++
 5 files changed, 59 insertions(+), 2 deletions(-)
 create mode 100644 newlib/libc/string/gnu_basename.c

diff --git a/newlib/libc/include/libgen.h b/newlib/libc/include/libgen.h
index abfab0e..8360a22 100644
--- a/newlib/libc/include/libgen.h
+++ b/newlib/libc/include/libgen.h
 <at>  <at>  -13,6 +13,7  <at>  <at>  extern "C" {
 #endif

 char      *_EXFUN(basename,     (char *));
+#define _BASENAME_DEFINED
 char      *_EXFUN(dirname,     (char *));

 #ifdef __cplusplus
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 43b3626..58cc0c6 100644
(Continue reading)

Jon TURNEY | 13 Mar 15:07 2015
Picon

[PATCH] Fix info directory entry


I have no clue about info pages, but the attached patch seems to be 
needed for 'info libc' and 'info libm' to work as expected, after the 
newlib info has been installed using install-info.
From 2bb8d6edd96fd7eb4d82f61ce6da360ccebe670a Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney <at> dronecode.org.uk>
Date: Thu, 12 Mar 2015 17:22:23 +0000
Subject: [PATCH] Fix newlib texinfo source so 'info libc' and 'info libm' work

If the newlib .info files are installed using install-info, 'info libc' and
'info libm' don't work.

This seems to be due to the formatting of the directory entry line not being
quite right, so fix that.

Also use  <at> direntry texinfo command, rather than writing .info directory entry
literally.

Also use  <at> dircategory texinfo command to place into 'Newlib' category, rather
than ending up in 'Miscellaneous'

newlib/ChangeLog:

2015-03-13  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

	* libc/libc.texinfo: Fix directory entry.
	* libm/libm.texinfo: Ditto.
---
(Continue reading)

Sebastian Huber | 13 Mar 11:00 2015
Picon

[PATCH v3] Merge parts of <sys/time.h> from FreeBSD

Merge parts of the latest <sys/time.h> from FreeBSD to Newlib.  This has
two reasons.

1. We want to use the FreeBSD timecounters for timekeeping in RTEMS.
See also https://devel.rtems.org/ticket/2271.

2. This makes the port of the network stack from FreeBSD easier.

newlib/ChangeLog
2015-03-12  Sebastian Huber  <sebastian.huber <at> embedded-brains.de>

	* libc/include/machine/_types.h (__suseconds_t): Define.
	* libc/include/sys/_timeval.h: Import from FreeBSD and add
	MinGW-w64 compatibility.
	(timerclear): Copy from FreeBSD <sys/time.h>.
	(timerisset): Likewise.
	(timercmp): Likewise.
	(timeradd): Likewise.
	(timersub): Likewise.
	* libc/include/sys/time.h: (bintime, ...) Import from FreeBSD.
	(timespecclear, ...): Likewise.
	(inittodr, ...): Likewise.
	(timerclear): Delete.
	(timerisset): Likewise.
	(timercmp): Likewise.
	(timeradd): Likewise.
	(timersub): Likewise.
	(futimes): Declare if __BSD_VISIBLE.
	(futimesat): Likewise.
	(lutimes): Likewise.
(Continue reading)

Rasmus Bo Sørensen | 13 Mar 10:29 2015
Picon
Picon

Non reentrant floating point functions?

Hi,

I just started using the floating point functions of newlib on an
embedded multicore processor that we are developing at the Technical University of Denmark.
I am puzzled about the "#ifndef _REENT_ONLY"  in line 125 of 'newlib/libc/include/math.h'.
Are the functions in lines 127 - 138 not meant to be reentrant?
And in this case what is it that makes them non-reentrant?

Best regards,
Rasmus
Corinna Vinschen | 12 Mar 17:14 2015
Picon

Re: [PATCH 2/2 v2] Merge parts of <sys/time.h> from FreeBSD

On Mar 12 14:17, Sebastian Huber wrote:
> tklFqMHF5C3moKE+1wx3/zV2VT4pnAu7F
>  hn1c1+wDWNrqs9dkyEecEH6cqeynx6fnA3DO+aY1cVzw==
> Status: O
> Content-Length: 20077
> Lines: 669
> 
> Merge parts of the latest <sys/time.h> from FreeBSD to Newlib.  This has
> two reasons.
> 
> 1. We want to use the FreeBSD timecounters for timekeeping in RTEMS.
> See also https://devel.rtems.org/ticket/2271.
> 
> 2. This makes the port of the network stack from FreeBSD easier.

This patch breaks Cygwin.  The problem is that the introduction of
sys/_timeval.h drops the _TIMEVAL_DEFINED guards.  These guards,
guarding

  struct timeval
  timerisset
  timercmp
  timerclear

plus only in newlib

  timeradd
  timersub

are shared with the Mingw-w64 header _timeval.h which defines struct
(Continue reading)

Corinna Vinschen | 12 Mar 16:04 2015
Picon

Re: [PATCH 1/2 v2] Use latest <semaphore.h> from FreeBSD for RTEMS

On Mar 12 14:17, Sebastian Huber wrote:
> Import the latest <semaphore.h> from FreeBSD and adjust it for RTEMS.
> The OpenMP support from GCC (libgomp) needs a <semaphore.h>.
> 
> Delete SEM_VALUE_MAX from the original FreeBSD version since this is
> defined in <limits.h> for RTEMS.

Applied.

Thanks,
Corinna

--

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Sebastian Huber | 12 Mar 14:17 2015
Picon

[PATCH 2/2 v2] Merge parts of <sys/time.h> from FreeBSD

Merge parts of the latest <sys/time.h> from FreeBSD to Newlib.  This has
two reasons.

1. We want to use the FreeBSD timecounters for timekeeping in RTEMS.
See also https://devel.rtems.org/ticket/2271.

2. This makes the port of the network stack from FreeBSD easier.

newlib/ChangeLog
2015-03-12  Sebastian Huber  <sebastian.huber <at> embedded-brains.de>

	* libc/include/machine/_types.h (__suseconds_t): Define.
	* libc/include/sys/_timeval.h: Import from FreeBSD.
	* libc/include/sys/time.h: (bintime, ...) Import from FreeBSD.
	(timespecclear, ...): Likewise.
	(inittodr, ...): Likewise.
	(timerclear): Use FreeBSD format.
	(timerisset): Likewise.
	(timercmp): Likewise.
	(timeradd): Likewise.
	(timersub): Likewise.
	(futimes): Declare if __BSD_VISIBLE.
	(futimesat): Likewise.
	(lutimes): Likewise.
	(setitimer): Declare unconditionally.
	(gettimeofday): Declare if __XSI_VISIBLE.
	* libc/include/sys/types.h (sbintime_t): Define.
	(suseconds_t): Define conditionally via __suseconds_t.
---
 newlib/libc/include/machine/types.h |   2 +
(Continue reading)


Gmane