mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
Remove leftover pre-C89 code (re: a1f5c992
)
I'd forgotten to check for uses of the __STDC__ macro. This is defined on all C compilers that support C89/C90 or later standards. So we can remove all fallback code disabled by that macro.
This commit is contained in:
parent
e072e7c170
commit
2027648f1a
12 changed files with 4 additions and 104 deletions
|
@ -110,7 +110,7 @@ static const char usage[] =
|
|||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#if !_PACKAGE_ast && defined(__STDC__)
|
||||
#if !_PACKAGE_ast
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
|
|
@ -46,11 +46,7 @@
|
|||
#define NiL ((void*)0)
|
||||
#endif
|
||||
#ifndef NoN
|
||||
#if defined(__STDC__) || defined(__STDPP__)
|
||||
#define NoN(x) void _STUB_ ## x () {}
|
||||
#else
|
||||
#define NoN(x) void _STUB_/**/x () {}
|
||||
#endif
|
||||
#if !defined(_STUB_)
|
||||
#define _STUB_
|
||||
#endif
|
||||
|
|
|
@ -77,15 +77,10 @@ typedef struct _dtlib_s
|
|||
|
||||
#if _BLD_cdt
|
||||
|
||||
#if defined(__STDC__)
|
||||
#define CDTLIB(m) __DEFINE__(Dtmethod_t*,m,&_##m);
|
||||
#else
|
||||
#define CDTLIB(m) __DEFINE__(Dtmethod_t*,m,&_/**/m);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__STDC__)
|
||||
#define CDTLIB(m) \
|
||||
void* cdt_lib(const char* name, Dtdisc_t* disc, const char* type) \
|
||||
{ \
|
||||
|
@ -102,24 +97,6 @@ typedef struct _dtlib_s
|
|||
return 0; \
|
||||
} \
|
||||
unsigned long plugin_version(void) { return CDT_PLUGIN_VERSION; }
|
||||
#else
|
||||
#define CDTLIB(m) \
|
||||
void* cdt_lib(name, disc, type) const char* name; Dtdisc_t* disc; const char* type; \
|
||||
{ \
|
||||
int i; \
|
||||
int n; \
|
||||
if (!type) \
|
||||
return &cdt_lib_/**/m; \
|
||||
n = strlen(cdt_lib_/**/m.prefix); \
|
||||
if (!strncmp(type, cdt_lib_/**/m.prefix, n)) \
|
||||
type += n; \
|
||||
for (i = 0; cdt_lib_/**/m.methods[i]; i++) \
|
||||
if (!strcmp(type, cdt_lib_/**/m.methods[i]->name + n)) \
|
||||
return cdt_lib_/**/m.methods[i]; \
|
||||
return 0; \
|
||||
} \
|
||||
unsigned long plugin_version() { return CDT_PLUGIN_VERSION; }
|
||||
#endif
|
||||
|
||||
#endif /* _BLD_cdt */
|
||||
|
||||
|
|
|
@ -97,13 +97,8 @@ cat{
|
|||
# endif
|
||||
#endif
|
||||
#if _dll_import && ( !_BLD_DLL || _WINIX && !_UWIN )
|
||||
# ifdef __STDC__
|
||||
# define __EXTERN__(T,obj) extern T obj; T* _imp__ ## obj = &obj
|
||||
# define __DEFINE__(T,obj,val) T obj = val; T* _imp__ ## obj = &obj
|
||||
# else
|
||||
# define __EXTERN__(T,obj) extern T obj; T* _imp__/**/obj = &obj
|
||||
# define __DEFINE__(T,obj,val) T obj = val; T* _imp__/**/obj = &obj
|
||||
# endif
|
||||
#else
|
||||
# define __EXTERN__(T,obj) extern T obj
|
||||
# define __DEFINE__(T,obj,val) T obj = val
|
||||
|
|
|
@ -37,10 +37,8 @@
|
|||
|
||||
#if _typ_off64_t
|
||||
#undef off_t
|
||||
#ifdef __STDC__
|
||||
#define off_t off_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _hdr_fcntl
|
||||
#include <fcntl.h>
|
||||
|
@ -73,19 +71,15 @@ main()
|
|||
|
||||
printf("#if _typ_off64_t\n");
|
||||
printf("#undef off_t\n");
|
||||
printf("#ifdef __STDC__\n");
|
||||
printf("#define off_t off_t\n");
|
||||
printf("#endif\n");
|
||||
printf("#endif\n");
|
||||
printf("\n");
|
||||
printf("#include <ast_fs.h>\n");
|
||||
printf("\n");
|
||||
printf("#if _typ_off64_t\n");
|
||||
printf("#undef off_t\n");
|
||||
printf("#ifdef __STDC__\n");
|
||||
printf("#define off_t off_t\n");
|
||||
printf("#endif\n");
|
||||
printf("#endif\n");
|
||||
printf("\n");
|
||||
printf("#include <fcntl.h>\n");
|
||||
#if _hdr_mman
|
||||
|
|
|
@ -130,11 +130,7 @@ int main()
|
|||
|
||||
#ifndef UCHAR_MAX
|
||||
val = uc;
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define UCHAR_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define UCHAR_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifndef SCHAR_MIN
|
||||
|
@ -170,11 +166,7 @@ int main()
|
|||
|
||||
#ifndef USHRT_MAX
|
||||
val = us;
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define USHRT_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define USHRT_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifndef SHRT_MIN
|
||||
|
@ -205,11 +197,7 @@ int main()
|
|||
{
|
||||
#ifndef UINT_MAX
|
||||
val = ui;
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define UINT_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define UINT_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifndef INT_MIN
|
||||
|
@ -242,11 +230,7 @@ int main()
|
|||
{
|
||||
#ifndef ULONG_MAX
|
||||
val = ul;
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define ULONG_MAX %luLU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define ULONG_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
|
@ -280,7 +264,7 @@ int main()
|
|||
#ifndef ULLONG_MAX
|
||||
vll = ull;
|
||||
printf("#ifndef ULLONG_MAX\n");
|
||||
printf("#if defined(__STDC__) && _ast_LL\n");
|
||||
printf("#if _ast_LL\n");
|
||||
printf("#define ULLONG_MAX %lluULL\n", vll);
|
||||
printf("#else\n");
|
||||
printf("#define ULLONG_MAX %llu\n", vll);
|
||||
|
@ -291,7 +275,7 @@ int main()
|
|||
#ifndef LLONG_MIN
|
||||
vll = (uint64_t)(ull >> 1) + 1;
|
||||
printf("#ifndef LLONG_MIN\n");
|
||||
printf("#if defined(__STDC__) && _ast_LL\n");
|
||||
printf("#if _ast_LL\n");
|
||||
printf("#define LLONG_MIN (-%lluLL-1LL)\n", vll - 1);
|
||||
printf("#else\n");
|
||||
printf("#define LLONG_MIN (-%llu-1)\n", vll - 1);
|
||||
|
@ -302,7 +286,7 @@ int main()
|
|||
#ifndef LLONG_MAX
|
||||
vll = (uint64_t)(ull >> 1);
|
||||
printf("#ifndef LLONG_MAX\n");
|
||||
printf("#if defined(__STDC__) && _ast_LL\n");
|
||||
printf("#if _ast_LL\n");
|
||||
printf("#define LLONG_MAX %lluLL\n", vll);
|
||||
printf("#else\n");
|
||||
printf("#define LLONG_MAX %llu\n", vll);
|
||||
|
|
|
@ -38,10 +38,6 @@ print #if !_lib_readdir64
|
|||
print #undef _typ_ino64_t
|
||||
print #endif
|
||||
|
||||
print #if defined(__STDC__) && !defined(__USE_FIXED_PROTOTYPES__)
|
||||
print #define __USE_FIXED_PROTOTYPES__ 1 /* kick gcc out of the past */
|
||||
print #endif
|
||||
|
||||
header stdlib.h
|
||||
header stddef.h
|
||||
header sys/types.h
|
||||
|
|
|
@ -33,11 +33,7 @@
|
|||
#endif
|
||||
#define SH_PLUGIN_VERSION AST_PLUGIN_VERSION(20111111L)
|
||||
|
||||
#if __STDC__
|
||||
#define SHLIB(m) unsigned long plugin_version(void) { return SH_PLUGIN_VERSION; }
|
||||
#else
|
||||
#define SHLIB(m) unsigned long plugin_version() { return SH_PLUGIN_VERSION; }
|
||||
#endif
|
||||
|
||||
#ifndef SH_VERSION
|
||||
# define Shell_t void
|
||||
|
|
|
@ -39,10 +39,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
typedef struct Link_s
|
||||
{
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
* Phong Vo <kpv@research.att.com> *
|
||||
* *
|
||||
***********************************************************************/
|
||||
#if __STDC__
|
||||
#include "FEATURE/standards"
|
||||
#endif
|
||||
#include "sfhdr.h"
|
||||
|
||||
/* Convert a floating point value to ASCII.
|
||||
|
|
|
@ -1206,30 +1206,6 @@ extern Sfdouble_t ldexpl(Sfdouble_t, int);
|
|||
|
||||
#if !_PACKAGE_ast
|
||||
|
||||
#if !__STDC__ && !_hdr_stdlib
|
||||
extern void abort(void);
|
||||
extern int atexit(void(*)(void));
|
||||
extern char* getenv(const char*);
|
||||
extern void* malloc(size_t);
|
||||
extern void* realloc(void*, size_t);
|
||||
extern void free(void*);
|
||||
extern size_t strlen(const char*);
|
||||
extern char* strcpy(char*, const char*);
|
||||
|
||||
extern void* memset(void*, int, size_t);
|
||||
extern void* memchr(const void*, int, size_t);
|
||||
extern void* memccpy(void*, const void*, int, size_t);
|
||||
#ifndef memcpy
|
||||
extern void* memcpy(void*, const void*, size_t);
|
||||
#endif
|
||||
#if !defined(strtod)
|
||||
extern double strtod(const char*, char**);
|
||||
#endif
|
||||
#if !defined(remove)
|
||||
extern int sysremovef(const char*);
|
||||
#endif
|
||||
#endif /* !__STDC__ && !_hdr_stdlib */
|
||||
|
||||
#if !_hdr_unistd
|
||||
extern int sysclosef(int);
|
||||
extern ssize_t sysreadf(int, void*, size_t);
|
||||
|
|
|
@ -487,18 +487,8 @@ extern int getpagesize(void);
|
|||
extern void* sbrk(ssize_t);
|
||||
#endif
|
||||
|
||||
#if !__STDC__ && !_hdr_stdlib
|
||||
extern size_t strlen( const char* );
|
||||
extern char* strcpy( char*, const char* );
|
||||
extern int strcmp( const char*, const char* );
|
||||
extern int atexit( void(*)(void) );
|
||||
extern char* getenv( const char* );
|
||||
extern void* memcpy( void*, const void*, size_t );
|
||||
extern void* memset( void*, int, size_t );
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/* for vmexit.c */
|
||||
extern int onexit( void(*)(void) );
|
||||
|
|
Loading…
Reference in a new issue