Skip to content

Commit

Permalink
gcc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyg committed May 28, 2022
1 parent e8d9824 commit f072d4e
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 27 deletions.
6 changes: 5 additions & 1 deletion libmisc/bsd_qsort.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_bsd_qsort_c,"$Id: bsd_qsort.c,v 1.7 2020/04/11 21:37:12 cvsuser Exp $")
__CIDENT_RCSID(gr_bsd_qsort_c,"$Id: bsd_qsort.c,v 1.8 2022/05/25 15:44:02 cvsuser Exp $")

/*- -*- indent-width: 4; tabs: 8; -*-
* Copyright (c) 1992, 1993
Expand Down Expand Up @@ -37,6 +37,10 @@ __CIDENT_RCSID(gr_bsd_qsort_c,"$Id: bsd_qsort.c,v 1.7 2020/04/11 21:37:12 cvsuse

#include <stdlib.h>

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif

#ifdef I_AM_QSORT_R
#define cmp_t sortcmpr_t
#define CMP(t, x, y) (cmp((t), (x), (y)))
Expand Down
6 changes: 5 additions & 1 deletion libmisc/bsd_radixsort.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_bsd_radixsort_c,"$Id: bsd_radixsort.c,v 1.9 2020/06/05 23:29:50 cvsuser Exp $")
__CIDENT_RCSID(gr_bsd_radixsort_c,"$Id: bsd_radixsort.c,v 1.10 2022/05/25 15:44:02 cvsuser Exp $")

/*- -*- indent-width: 8; tabs: 8; -*-
* Copyright (c) 1990, 1993
Expand Down Expand Up @@ -65,6 +65,10 @@ typedef struct {
int sn, si;
} stack;

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif

static __CINLINE void simplesort(const u_char **, int, int, const u_char *, u_int);
static void r_sort_a(const u_char **, int, int, const u_char *, u_int);
static void r_sort_b(const u_char **, const u_char **, int, int, const u_char *, u_int);
Expand Down
8 changes: 6 additions & 2 deletions libmisc/crc32.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_crc32_c,"$Id: crc32.c,v 1.10 2017/01/29 04:33:31 cvsuser Exp $")
__CIDENT_RCSID(gr_crc32_c,"$Id: crc32.c,v 1.11 2022/05/25 15:44:02 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: crc32.c,v 1.10 2017/01/29 04:33:31 cvsuser Exp $
/* $Id: crc32.c,v 1.11 2022/05/25 15:44:02 cvsuser Exp $
*
* The CRC32 employs the reverse-polynomial calculation method on the
* polynomial 0xEDB88320 used as the frame check sequence in ADCCP (ANSI
Expand Down Expand Up @@ -149,6 +149,10 @@ crc32_EDB88320(const void *data, size_t size, uint32_t crc32)

#define HASH crc = crc32_table[(*p++ ^ (unsigned char)crc)] ^ (crc >> 8)

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif

loop = (size + 8 - 1) >> 3;
switch (size & (8 - 1)) {
case 0:
Expand Down
8 changes: 6 additions & 2 deletions libmisc/edbt_win32.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_edbt_win32_c,"$Id: edbt_win32.c,v 1.22 2020/06/18 13:15:07 cvsuser Exp $")
__CIDENT_RCSID(gr_edbt_win32_c,"$Id: edbt_win32.c,v 1.23 2022/05/25 15:44:58 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: edbt_win32.c,v 1.22 2020/06/18 13:15:07 cvsuser Exp $
/* $Id: edbt_win32.c,v 1.23 2022/05/25 15:44:58 cvsuser Exp $
* win32 (include cygwin) backtrace implementation.
*
*
Expand Down Expand Up @@ -46,6 +46,10 @@ __CIDENT_RCSID(gr_edbt_win32_c,"$Id: edbt_win32.c,v 1.22 2020/06/18 13:15:07 cvs
#undef u_char
#include <windows.h>

#if defined(__MINGW32__) /* Kernel32 */
VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord);
#endif

#if defined(__WATCOMC__) || defined(__CYGWIN__) || defined(__MINGW32__)
/* WATCOMC 1.9, 64bit issues */
/* CYGWIN 1.7, no 64 support */
Expand Down
5 changes: 3 additions & 2 deletions libmisc/edthreads_pthread.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_edthreads_pthread_c,"$Id: edthreads_pthread.c,v 1.10 2017/01/29 04:33:31 cvsuser Exp $")
__CIDENT_RCSID(gr_edthreads_pthread_c,"$Id: edthreads_pthread.c,v 1.11 2022/05/25 15:45:19 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: edthreads_pthread.c,v 1.10 2017/01/29 04:33:31 cvsuser Exp $
/* $Id: edthreads_pthread.c,v 1.11 2022/05/25 15:45:19 cvsuser Exp $
* C11 threads implementation, for/using pthreads
* based on ISO/IEC 9899:201x Committee Draft, April 12, 2011
*
Expand Down Expand Up @@ -777,6 +777,7 @@ tss_set(tss_t key, void *val)

#else

extern void edthreads_pthreads_notimplemented(void);
void
edthreads_pthreads_notimplemented(void)
{
Expand Down
31 changes: 23 additions & 8 deletions libmisc/edthreads_win32.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_edthreads_win32_c,"$Id: edthreads_win32.c,v 1.18 2020/06/21 01:36:17 cvsuser Exp $")
__CIDENT_RCSID(gr_edthreads_win32_c,"$Id: edthreads_win32.c,v 1.20 2022/05/26 16:02:19 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: edthreads_win32.c,v 1.18 2020/06/21 01:36:17 cvsuser Exp $
/* $Id: edthreads_win32.c,v 1.20 2022/05/26 16:02:19 cvsuser Exp $
* C11 threads implementation, for windows
* based on ISO/IEC 9899:201x Committee Draft, April 12, 2011 N1570
*
*
*
* Copyright (c) 1998 - 2020, Adam Young.
* Copyright (c) 1998 - 2022, Adam Young.
* All rights reserved.
*
* This file is part of the GRIEF Editor.
Expand Down Expand Up @@ -58,7 +58,8 @@ edthreads_win32_native(void)
// with the following 'other' POSIX realtime functions missing.
//
#if !defined(HAVE_PTHREAD_H)
#error pthreads expected under mingw32
#define WIN32_NATIVE_MUTEX
#pragma message "pthreads expected under mingw32; enabling local implementation"
#endif

#ifndef WIN32_LEAN_AND_MEAN
Expand Down Expand Up @@ -94,11 +95,15 @@ nanosleep(const struct timespec *rqtp, struct timespec *rmtp /*notused*/)
return usleep(rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000);
}


#elif defined(_WIN32) || defined(WIN32)
#define WIN32_NATIVE_MUTEX
#endif

//
// Native Win threading
// Native Windows threading
//
#if defined(WIN32_NATIVE_MUTEX)

#if defined(__CYGWIN__)
#error incorrect target, win32 only
#endif
Expand All @@ -107,8 +112,6 @@ nanosleep(const struct timespec *rqtp, struct timespec *rmtp /*notused*/)
#include <edassert.h>
#include <tailqueue.h>



#define MTX_MAGIC MKMAGIC('W','M','t','x')

#define SIGNAL 0
Expand Down Expand Up @@ -900,6 +903,7 @@ timespec_get(struct timespec *ts, int __unused_based)
#endif /*FIXME - HAVE_TIMESPEC_GET*/


// typedef VOID (NTAPI *PIMAGE_TLS_CALLBACK) (PVOID DllHandle, DWORD Reason, PVOID Reserved);
static void WINAPI
__tss_callback(void *image, DWORD reason, void *pv)
{
Expand Down Expand Up @@ -963,6 +967,7 @@ __tss_init(void)
* XCL library inits
* XCU user inits
*
* Runtime hooks:
* XCA/XCZ C++ initializers
* XIA/XIZ C initializers
* XPA/XPZ C pre-terminators
Expand All @@ -975,6 +980,16 @@ __declspec(allocate(".CRT$XLC")) void *__edthr_xlc = __tss_callback;
#pragma section(".CRT$XIU",long,read)
__declspec(allocate(".CRT$XIU")) void *__edthr_xiu = __tss_init;

#elif defined(__MINGW32__)
#pragma data_seg(".CRT$XLC","DATA")
void *__edthr_xlc = __tss_callback;

__attribute__((constructor))
static void tss_constructor() {
// objdump -x edthreads_win32.o | grep ctors
__tss_init();
}

#else
#pragma data_seg(".CRT$XLC","DATA")
void *__edthr_xlc = __tss_callback;
Expand Down
11 changes: 6 additions & 5 deletions libmisc/getopt_common.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_getopt_common_c,"$Id: getopt_common.c,v 1.9 2020/06/18 13:16:22 cvsuser Exp $")
__CIDENT_RCSID(gr_getopt_common_c,"$Id: getopt_common.c,v 1.10 2022/05/25 15:44:02 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: getopt_common.c,v 1.9 2020/06/18 13:16:22 cvsuser Exp $
/* $Id: getopt_common.c,v 1.10 2022/05/25 15:44:02 cvsuser Exp $
* common globals getopt/bsd_getopt.
*
*
Expand Down Expand Up @@ -36,6 +36,7 @@ __CIDENT_RCSID(gr_getopt_common_c,"$Id: getopt_common.c,v 1.9 2020/06/18 13:16:2
#include <getopt.h>

#elif defined(__MINGW32__)
#include <getopt.h>

#elif defined(_WIN32) || defined(WIN32)

Expand All @@ -47,10 +48,10 @@ int optreset = 0; /* reset getopt */

#endif

extern void __getopt_common(void);

extern void __getopt_common_dummy(void);
void
__getopt_common_dummy() {
__getopt_common_dummy()
{
}

/*end*/
10 changes: 5 additions & 5 deletions libmisc/strparse.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_strparse_c,"$Id: strparse.c,v 1.13 2020/05/03 21:09:06 cvsuser Exp $")
__CIDENT_RCSID(gr_strparse_c,"$Id: strparse.c,v 1.14 2022/05/25 15:44:02 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: strparse.c,v 1.13 2020/05/03 21:09:06 cvsuser Exp $
/* $Id: strparse.c,v 1.14 2022/05/25 15:44:02 cvsuser Exp $
* libstr - String to numeric (float/integer) parser.
*
*
Expand Down Expand Up @@ -448,7 +448,7 @@ chxmatch(struct parse *p, const char *s)
if (ch != match) { /* same case */
break;
}
assert(count < sizeof(stack));
assert(count < (int)sizeof(stack));
stack[count++] = ch;
ch = -1;
}
Expand Down Expand Up @@ -478,7 +478,7 @@ chmatch(struct parse *p, const char *s)
if (tolower(ch) != tolower(match)) {/* case insensitive */
break;
}
assert(count < sizeof(stack));
assert(count < (int)sizeof(stack));
stack[count++] = ch;
ch = -1;
}
Expand Down Expand Up @@ -852,4 +852,4 @@ main(void)
}
#endif /*LOCAL_MAIN*/

/*end*/
/*end*/
4 changes: 3 additions & 1 deletion libmisc/win32wsa.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GR_WIN32WSA_H_INCLUDED
#define GR_WIN32WSA_H_INCLUDED
/* -*- mode: c; indent-width: 4; -*- */
/* $Id: win32wsa.h,v 1.9 2017/01/29 04:33:32 cvsuser Exp $
/* $Id: win32wsa.h,v 1.10 2022/05/25 15:45:31 cvsuser Exp $
* WSA Error Codes
* Reproduced from a number of sources.
*
Expand Down Expand Up @@ -176,9 +176,11 @@
{ ETIMEDOUT, // 138
"Connection timed out (POSIX.1)"
},
#if defined(ETXTBSY)
{ ETXTBSY, // 139
"Text file busy (POSIX.1)"
},
#endif
{ EWOULDBLOCK, // 140
"Operation would block (POSIX.1)"
},
Expand Down

0 comments on commit f072d4e

Please sign in to comment.