Cleanup Cygwin builds.

* windows/Makefile.am (loaddrv_LDFLAGS): remove, the -mno-cygwin
flag is supposed to be set in CFLAGS by ./configure
* configure.ac: add a check for the presence of usleep(), add a
check whether the linker accepts -static
* avrdude.h: protect prototype for usleep by !defined(HAVE_USLEEP)
* ppwin.c (usleep): protect by !defined(HAVE_USLEEP)
* main.c: silence "array subscript of type char" compiler warnings
by casting all arguments to tolower()/toupper() and isspace()/
isdigit()/ispunct() to "int"
* butterfly.c: (Dito.)
* avr910.c: (Dito.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@936 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2010-01-22 16:40:17 +00:00
parent 1c4db09770
commit 83fa6c7934
9 changed files with 59 additions and 32 deletions

View File

@ -1,3 +1,18 @@
2010-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Cleanup Cygwin builds.
* windows/Makefile.am (loaddrv_LDFLAGS): remove, the -mno-cygwin
flag is supposed to be set in CFLAGS by ./configure
* configure.ac: add a check for the presence of usleep(), add a
check whether the linker accepts -static
* avrdude.h: protect prototype for usleep by !defined(HAVE_USLEEP)
* ppwin.c (usleep): protect by !defined(HAVE_USLEEP)
* main.c: silence "array subscript of type char" compiler warnings
by casting all arguments to tolower()/toupper() and isspace()/
isdigit()/ispunct() to "int"
* butterfly.c: (Dito.)
* avr910.c: (Dito.)
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump for post-5.10.

View File

@ -624,7 +624,7 @@ static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
cmd = malloc(4 + blocksize);
if (!cmd) rval = -1;
cmd[0] = 'B';
cmd[3] = toupper(m->desc[0]);
cmd[3] = toupper((int)(m->desc[0]));
while (addr < max_addr) {
if ((max_addr - addr) < blocksize) {
@ -714,7 +714,7 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
int blocksize = PDATA(pgm)->buffersize;
cmd[0] = 'g';
cmd[3] = toupper(m->desc[0]);
cmd[3] = toupper((int)(m->desc[0]));
avr910_set_addr(pgm, addr);

View File

@ -39,14 +39,9 @@ extern int quell_progress; /* quiteness level (-q, -qq) */
extern "C" {
#endif
/* usleep replacements */
/* sleep Windows in ms, Unix usleep in us
#define usleep(us) Sleep((us)<20000?20:us/1000)
#define usleep(us) Sleep(us/1000)
#define ANTIWARP 3
#define usleep(us) Sleep(us/1000*ANTIWARP)
*/
#if !defined(HAVE_USLEEP)
int usleep(unsigned int us);
#endif
#if !defined(HAVE_GETTIMEOFDAY)
struct timezone;

View File

@ -423,7 +423,7 @@ static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
{
cmd[0] = 'B';
cmd[1] = 0;
if ((cmd[3] = toupper(m->desc[0])) == 'E') { /* write to eeprom */
if ((cmd[3] = toupper((int)(m->desc[0]))) == 'E') { /* write to eeprom */
cmd[2] = 1;
cmd[4] = value;
size = 5;
@ -572,7 +572,7 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
cmd = malloc(4+blocksize);
if (!cmd) return -1;
cmd[0] = 'B';
cmd[3] = toupper(m->desc[0]);
cmd[3] = toupper((int)(m->desc[0]));
while (addr < max_addr) {
if ((max_addr - addr) < blocksize) {
@ -613,7 +613,7 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
int blocksize = PDATA(pgm)->buffersize;
cmd[0] = 'g';
cmd[3] = toupper(m->desc[0]);
cmd[3] = toupper((int)(m->desc[0]));
if (use_ext_addr) {
butterfly_set_extaddr(pgm, addr);

View File

@ -77,7 +77,7 @@ AC_C_CONST
AC_HEADER_TIME
# Checks for library functions.
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday])
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep])
AC_MSG_CHECKING([for a Win32 HID libray])
SAVED_LIBS="${LIBS}"
@ -273,7 +273,7 @@ case $target in
# does this compiler support -mno-cygwin?
AC_MSG_CHECKING([if $CC accepts -mno-cygwin])
safe_CFLAGS=$CFLAGS
safe_CFLAGS="$CFLAGS"
CFLAGS="$ENABLE_WARNINGS -mno-cygwin"
AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
@ -283,7 +283,7 @@ case $target in
no_cygwin=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
CFLAGS="$safe_CFLAGS"
if test x$no_cygwin = xyes; then
CFLAGS="${CFLAGS} -mno-cygwin"
@ -295,9 +295,26 @@ case $target in
AC_MSG_NOTICE([])
fi
fi
AC_MSG_CHECKING([if linker accepts -static])
safe_LDFLAGS="$LDFLAGS"
LDFLAGS="${LDFLAGS} -static"
AC_TRY_LINK(, [ int main () { return 0 ; } ], [
can_link_static=yes
AC_MSG_RESULT([yes])
], [
can_link_static_cygwin=no
AC_MSG_RESULT([no])
])
LDFLAGS="$safe_LDFLAGS"
if test x$can_link_static = xyes; then
LDFLAGS="${LDFLAGS} -static"
fi
WINDOWS_DIRS="windows"
CFLAGS="${CFLAGS} -DWIN32NATIVE"
LDFLAGS="${LDFLAGS} -static"
;;
esac
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)

8
main.c
View File

@ -1131,7 +1131,7 @@ int main(int argc, char * argv [])
else
safemode_response = yes;
if (tolower(safemode_response[0]) == 'y') {
if (tolower((int)(safemode_response[0])) == 'y') {
/* Enough chit-chat, time to program some fuses and check them */
if (safemode_writefuse (safemode_fuse, "fuse", pgm, p,
@ -1159,7 +1159,7 @@ int main(int argc, char * argv [])
else
safemode_response = yes;
if (tolower(safemode_response[0]) == 'y') {
if (tolower((int)(safemode_response[0])) == 'y') {
/* Enough chit-chat, time to program some fuses and check them */
if (safemode_writefuse (safemode_lfuse, "lfuse", pgm, p,
@ -1184,7 +1184,7 @@ int main(int argc, char * argv [])
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
else
safemode_response = yes;
if (tolower(safemode_response[0]) == 'y') {
if (tolower((int)(safemode_response[0])) == 'y') {
/* Enough chit-chat, time to program some fuses and check them */
if (safemode_writefuse(safemode_hfuse, "hfuse", pgm, p,
@ -1209,7 +1209,7 @@ int main(int argc, char * argv [])
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
else
safemode_response = yes;
if (tolower(safemode_response[0]) == 'y') {
if (tolower((int)(safemode_response[0])) == 'y') {
/* Enough chit-chat, time to program some fuses and check them */
if (safemode_writefuse (safemode_efuse, "efuse", pgm, p,

View File

@ -374,6 +374,7 @@ int gettimeofday(struct timeval *tv, struct timezone *unused){
#endif
#if !defined(HAVE_USLEEP)
int usleep(unsigned int us)
{
int has_highperf;
@ -384,7 +385,7 @@ int usleep(unsigned int us)
// verify - increasing the delay helps sometimes but not
// realiably. There must be some other problem. Maybe just
// with my test-hardware maybe in the code-base.
//// us=(unsigned long) (us*1.5);
//// us=(unsigned long) (us*1.5);
has_highperf=QueryPerformanceFrequency(&freq);
@ -393,7 +394,7 @@ int usleep(unsigned int us)
if (has_highperf) {
QueryPerformanceCounter(&start);
loopend.QuadPart=start.QuadPart+freq.QuadPart*us/(1000*1000);
do {
do {
QueryPerformanceCounter(&stop);
} while (stop.QuadPart<=loopend.QuadPart);
}
@ -405,11 +406,12 @@ int usleep(unsigned int us)
DEBUG_QueryPerformanceCounter(&stop);
}
DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf);
return 0;
}
#endif /* !HAVE_USLEEP */
#endif

14
term.c
View File

@ -125,12 +125,12 @@ static int nexttok(char * buf, char ** tok, char ** next)
char * q, * n;
q = buf;
while (isspace(*q))
while (isspace((int)*q))
q++;
/* isolate first token */
n = q+1;
while (*n && !isspace(*n))
while (*n && !isspace((int)*n))
n++;
if (*n) {
@ -139,7 +139,7 @@ static int nexttok(char * buf, char ** tok, char ** next)
}
/* find start of next token */
while (isspace(*n))
while (isspace((int)*n))
n++;
*tok = q;
@ -189,9 +189,9 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
for (i=0; i<n; i++) {
memcpy(b, p, n);
buffer[i] = '.';
if (isalpha(b[i]) || isdigit(b[i]) || ispunct(b[i]))
if (isalpha((int)(b[i])) || isdigit((int)(b[i])) || ispunct((int)(b[i])))
buffer[i] = b[i];
else if (isspace(b[i]))
else if (isspace((int)(b[i])))
buffer[i] = ' ';
}
@ -909,7 +909,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p)
* find the start of the command, skipping any white space
*/
q = cmdbuf;
while (*q && isspace(*q))
while (*q && isspace((int)*q))
q++;
/* skip blank lines and comments */

View File

@ -37,8 +37,6 @@ EXTRA_DIST = \
bin_PROGRAMS = loaddrv
loaddrv_LDFLAGS = -mno-cygwin
loaddrv_SOURCES = \
loaddrv.c \
loaddrv.h