[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Testsuite (Was: How attached are people ...)
From: |
George Spelvin |
Subject: |
Re: [avr-libc-dev] Testsuite (Was: How attached are people ...) |
Date: |
7 Dec 2016 12:38:45 -0500 |
> Ah OK. Then I missed it, somehow.
Here's my patch. (ObLegalese: Yes, *of course* I grant permission for
this, and anything else I post to avr-libc-dev, to be distributed under
the terms of the 3-clause BSD license in the LICENSE file.)
BTW, is there a reason avr-libc doesn't use the "__flash" gcc extension?
It's so much more convenient than __attribute__((progmem)).
Not only is the dereferencing syntax nicer (the compiler generates LD
or LPM as appropriate), but it enforces the "const" qualifier, and most
importantly, "char const *p" and "char const __flash *q" are different
types and can't be assigned to each other (without an explicit cast).
diff --git a/avr-libc/tests/simulate/stdlib/dtostre.h
b/avr-libc/tests/simulate/stdlib/dtostre.h
index 258db39b..d8614ea0 100644
--- a/avr-libc/tests/simulate/stdlib/dtostre.h
+++ b/avr-libc/tests/simulate/stdlib/dtostre.h
@@ -89,7 +89,7 @@ void run_dtostre (const struct dtostre_s *pt, int testno)
unsigned char prec, flags;
static char s[2*PZLEN + sizeof(pt->pattern)];
char c, *ps;
- const void *pv;
+ const char *pp;
memset(s, testno, sizeof(s));
@@ -111,17 +111,17 @@ void run_dtostre (const struct dtostre_s *pt, int testno)
exit (testno + 0x2000);
}
- pv = & pt->pattern;
+ pp = pt->pattern;
#ifdef __AVR__
do {
- c = pgm_read_byte(pv++);
+ c = pgm_read_byte(pp++);
if (*ps++ != c) {
exit (testno + 0x3000);
}
} while (c);
#else
do {
- c = *(char *)(pv++);
+ c = *pp++;
if (*ps++ != c) {
printf ("*** testno= %d: must= %s was= %s\n",
testno, pt->pattern, s + PZLEN);
diff --git a/avr-libc/tests/simulate/stdlib/dtostrf.h
b/avr-libc/tests/simulate/stdlib/dtostrf.h
index 0931b1fd..c576cfb2 100644
--- a/avr-libc/tests/simulate/stdlib/dtostrf.h
+++ b/avr-libc/tests/simulate/stdlib/dtostrf.h
@@ -74,7 +74,7 @@ void run_dtostrf (const struct dtostrf_s *pt, int testno)
unsigned char prec;
static char s[2*PZLEN + sizeof(pt->pattern)];
char c, *ps;
- void *pv;
+ char const *pp;
memset (s, testno, sizeof(s));
@@ -96,17 +96,17 @@ void run_dtostrf (const struct dtostrf_s *pt, int testno)
exit (testno + 0x2000);
}
- pv = & pt->pattern;
+ pp = pt->pattern;
#ifdef __AVR__
do {
- c = pgm_read_byte(pv++);
+ c = pgm_read_byte(pp++);
if (*ps++ != c) {
exit (testno + 0x3000);
}
} while (c);
#else
do {
- c = *(char *)(pv++);
+ c = *pp++;
if (*ps++ != c) {
printf ("*** testno= %d: must= %s was= %s\n",
testno, pt->pattern, s + PZLEN);
- Re: [avr-libc-dev] How attached are people to the implementation of rand()/random()?, (continued)
- Re: [avr-libc-dev] How attached are people to the implementation of rand()/random()?, Georg-Johann Lay, 2016/12/06
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Joerg Wunsch, 2016/12/06
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Joerg Wunsch, 2016/12/06
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Georg-Johann Lay, 2016/12/07
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Joerg Wunsch, 2016/12/07
- Re: [avr-libc-dev] How attached are people to the implementation of rand()/random()?, Pitchumani Sivanupandi, 2016/12/07
- Re: [avr-libc-dev] How attached are people to the implementation of rand()/random()?, George Spelvin, 2016/12/07
- Re: [avr-libc-dev] How attached are people to the implementation of rand()/random()?, Joerg Wunsch, 2016/12/07
- [avr-libc-dev] Testsuite (Was: How attached are people ...), George Spelvin, 2016/12/07
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Joerg Wunsch, 2016/12/07
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...),
George Spelvin <=
- Re: [avr-libc-dev] Testsuite (Was: How attached are people ...), Joerg Wunsch, 2016/12/07