MS VS inline/extern fix from Ben Alison plus comments.

Add explicit extern to functions that are locally declared inline
but which also have non-inline public prototypes.

It seems MS VS does not quite meet the C99 spec (section 6.7.4).
This commit is contained in:
Erik de Castro Lopo 2013-03-12 17:08:29 +11:00
parent 06f3812d79
commit 9edb817dd2
2 changed files with 26 additions and 0 deletions

View File

@ -1047,3 +1047,16 @@ FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *v
*val = v;
return true;
}
/* These functions a declared inline in this file but are also callable as
* externs from elsewhere.
* According to the C99 sepc, section 6.7.4, simply providing a function
* prototype in a header file without 'inline' and making the function inline
* in this file should be sufficient.
* Unfortunately, the Microsoft VS compiler doesn't pick them up externally. To
* fix that we add extern declarations here.
*/
extern FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br);
extern unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
extern unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
extern FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val);

View File

@ -848,3 +848,16 @@ FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw)
else
return true;
}
/* These functions a declared inline in this file but are also callable as
* externs from elsewhere.
* According to the C99 sepc, section 6.7.4, simply providing a function
* prototype in a header file without 'inline' and making the function inline
* in this file should be sufficient.
* Unfortunately, the Microsoft VS compiler doesn't pick them up externally. To
* fix that we add extern declarations here.
*/
extern FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
extern FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);
extern FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val);
extern FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals);