Drop tests for and CPP hackery for C99 struct flexible array feature.

This commit is contained in:
Erik de Castro Lopo 2013-02-06 18:45:35 +11:00
parent 66c5d9490c
commit e092a9f885
6 changed files with 9 additions and 39 deletions

View File

@ -1,3 +1,9 @@
2013-02-06 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac src/common.h src/ima_adpcm.c src/ms_adpcm.c src/paf.c
Drop tests for and #ifdef hackery for C99 struct flexible array feature.
libsndfile assumes the compiler supports most of the ISO C99 standard.
2013-02-05 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/alac.c

View File

@ -80,19 +80,6 @@ else
AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
[test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
#====================================================================================
# Check for support of the struct hack.
MN_C99_FLEXIBLE_ARRAY
if test x$ac_cv_c99_flexible_array = xyes ; then
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
else
AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
fi
#====================================================================================
# Couple of initializations here. Fill in real values later.

View File

@ -211,19 +211,8 @@ typedef struct
/* CAF */
unsigned int edit_number ;
#if HAVE_FLEXIBLE_ARRAY
/* the per channel peak info */
PEAK_POS peaks [] ;
#else
/*
** This is not ISO compliant C. It works on some compilers which
** don't support the ISO standard flexible struct array which is
** used above. If your compiler doesn't like this I suggest you find
** youself a 1999 ISO C standards compilant compiler. GCC-3.X is
** highly recommended.
*/
PEAK_POS peaks [0] ;
#endif
} PEAK_INFO ;
static inline PEAK_INFO *

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -37,11 +37,7 @@ typedef struct IMA_ADPCM_PRIVATE_tag
int stepindx [2] ;
unsigned char *block ;
short *samples ;
#if HAVE_FLEXIBLE_ARRAY
short data [] ; /* ISO C99 struct flexible array. */
#else
short data [0] ; /* This is a hack and might not work. */
#endif
} IMA_ADPCM_PRIVATE ;
/*============================================================================================

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -44,11 +44,7 @@ typedef struct
sf_count_t samplecount ;
short *samples ;
unsigned char *block ;
#if HAVE_FLEXIBLE_ARRAY
short dummydata [] ; /* ISO C99 struct flexible array. */
#else
short dummydata [0] ; /* This is a hack an might not work. */
#endif
} MSADPCM_PRIVATE ;
/*============================================================================================

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
@ -64,11 +64,7 @@ typedef struct
sf_count_t sample_count ;
int *samples ;
unsigned char *block ;
#if HAVE_FLEXIBLE_ARRAY
int data [] ; /* ISO C99 struct flexible array. */
#else
int data [1] ; /* This is a hack and may not work. */
#endif
} PAF24_PRIVATE ;
/*------------------------------------------------------------------------------