Commit Graph

44 Commits

Author SHA1 Message Date
James Almer 8ddf1795b9 avutil/attributes: add support for clang in AV_NOWARN_DEPRECATED
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-16 12:29:37 -03:00
Limin Wang 77e15f01fb avutil/attributes: Fix too many warning: false is not defined [-Wundef]
Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-30 17:29:23 +08:00
Dale Curtis fda1c74539 Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-27 21:05:52 +02:00
James Almer 072b14f390 Merge commit '8e2346154e6d58b733fd20326ce706f82fd91b3e'
* commit '8e2346154e6d58b733fd20326ce706f82fd91b3e':
  libavutil: Hook up the rest of the gcc specific attributes to clang as well

Merged-by: James Almer <jamrial@gmail.com>
2017-10-21 14:25:55 -03:00
James Almer 1ba5e456dd Merge commit '3aa9c523e9cf4f4a5e239ac737281e096c884907'
* commit '3aa9c523e9cf4f4a5e239ac737281e096c884907':
  libavutil: Define the noreturn attribute for clang in MSVC mode as well

Merged-by: James Almer <jamrial@gmail.com>
2017-10-21 14:21:12 -03:00
Martin Storsjö 8e2346154e libavutil: Hook up the rest of the gcc specific attributes to clang as well
Hook up all attributes that don't have a MSVC specific version at the
moment.

See f637046d31 for details.

These don't seem to be critical for building with clang in MSVC mode
though, and thus haven't been hooked up until now.

These seem to build fine with as old clang as 3.3 at least.
(clang 3.3 disguises itself as gcc 4.2 normally, so all of these
have been used for clang before, except for av_cold.)

The clang version numbers themselves are useless for detecting what
attributes are available, since Apple's clang builds use a completely
different versioning (presenting itself as e.g. clang 8.0 instead
of 3.8).

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-22 14:25:45 +02:00
Martin Storsjö 3aa9c523e9 libavutil: Define the noreturn attribute for clang in MSVC mode as well
This is a follow-up to f637046d31.

Without the noreturn attribute set, avconv_opt.c fails to build after
d2e6dd32a4 with the error "control may reach end of non-void function".
By making sure the noreturn attribute is set properly, this compiles
as intended.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-21 22:57:21 +01:00
Clément Bœsch 55b2cfa921 Merge commit 'f637046d3134a331e4b5a7243ac3dfb92735b8a5'
* commit 'f637046d3134a331e4b5a7243ac3dfb92735b8a5':
  libavutil: Always use some GCC style attributes on clang

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-02-02 11:26:05 +01:00
Martin Storsjö f637046d31 libavutil: Always use some GCC style attributes on clang
Clang normally disguises as GCC (defining __GNUC__), and thus get
all the normal GCC specific attributes.

Clang can also work as a drop-in replacement for MSVC, and in these
cases, it doesn't define __GNUC__, but defines _MSC_VER instead.

Even in these setups, it still supports the GCC style attributes,
thus use them, especially where there isn't any MSVC specific
version, or where the MSVC specific version doesn't work on clang
(for DECLARE_ASM_CONST).

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-07-21 12:52:19 +03:00
Ganesh Ajjanagadde 1d4af04adf avutil/attributes: add av_warn_unused_result
GCC 3.4 introduced an attribute warn_unused_result to warn when a programmer
discards the return value. Applying this judiciously across the codebase can help
in fixing a lot of problems. At a high level, functions which return error codes
should always be checked. More concretely, consider the functions ff_add_format
and the like in avfilter/formats.h. A quick examination shows that a large portion
of libavfilter fails to handle the associated errors, usually AVERROR(ENOMEM).
The above example was where I observed the utility of this, but it should be
useful in many places across the code base.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-05 19:30:20 +02:00
James Almer 36e1665d3d avutil/attributes: add AV_GCC_VERSION_AT_MOST
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-09-18 12:41:29 -03:00
Michael Niedermayer 06309fc704 avutil/attributes: Add () to protect the AV_GCC_VERSION_AT_LEAST() arguments
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 00:21:48 +01:00
Michael Niedermayer 08e7644b68 Merge commit '5858a67f135a7395c548482c73cf3d39bcdd3022'
* commit '5858a67f135a7395c548482c73cf3d39bcdd3022':
  attributes: disable flatten on llvm/clang

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-03 12:38:13 +01:00
Vittorio Giovara 5858a67f13 attributes: disable flatten on llvm/clang 2013-11-03 11:51:40 +01:00
Alex Smith 66c2f200b6 lavu/attributes: Don't define av_restrict
This is always defined in config.h.

Original patch by Derek Buitenhuis.
2013-09-21 15:43:31 +02:00
Michael Niedermayer 8377b2b6bf Merge commit '33b88f2a4ae54d5397c45e39a5326289ebdc7747'
* commit '33b88f2a4ae54d5397c45e39a5326289ebdc7747':
  msvc/icl: Use __declspec(noinline)

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-20 16:03:00 +02:00
Alex Smith 33b88f2a4a msvc/icl: Use __declspec(noinline)
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-20 14:40:06 +03:00
Alex Smith 09f2581dc5 msvc/icl: Use __declspec(deprecated)
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-20 14:40:06 +03:00
Kirill Gavrilov 0f48acf29b lavu: provide msvc implementation of attribute_deprecated
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-06 22:15:33 +02:00
Paul B Mahol 6dac8c8327 lavu: disable av_uninit for clang
This silence bunch of useless warnings like:

libavformat/mpeg.c:393:37: warning: variable 'dvdaudio_substream_type' is uninitialized when used within its own initialization [-Wuninitialized]

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2012-07-16 19:30:13 +00:00
Michael Niedermayer 86e107a7d4 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  cosmetics: Consistently use C-style comments with multiple inclusion guards
  anm: fix a few Doxygen comments
  misc typo and wording fixes
  attributes: add av_noreturn
  attributes: drop pointless define guards
  configure: do not disable av_always_inline with --enable-small
  flvdec: initial stream switch support
  avplay: fix write on freed memory for rawvideo
  snow: remove a VLA used for edge emulation
  x86: lavfi: fix gradfun/yadif build with mmx/sse disabled
  snow: remove the runs[] VLA.
  snow: Check mallocs at init
  flacdec: remove redundant setting of avctx->sample_fmt

Conflicts:
	ffplay.c
	libavcodec/h264.c
	libavcodec/snow.c
	libavcodec/snow.h
	libavcodec/snowdec.c
	libavcodec/snowenc.c
	libavformat/flvdec.c
	libavutil/attributes.h
	tools/patcheck

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-04 00:32:31 +02:00
Reinhard Tartler 22662ca560 attributes: add av_noreturn
Also use it in the declaration of the various exit_program
implementations in avtools.

inspired by a clang-scan report.
2012-07-03 17:26:51 +02:00
Reinhard Tartler a1641e9540 attributes: drop pointless define guards
the av_-prefixed attributes must not be defined outside of this file
2012-07-03 17:26:51 +02:00
Michael Niedermayer 64b25938e9 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section.
  dnxhdenc: add space between function argument type and comment.
  x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*
  attributes: Add a definition of av_always_inline for MSVC
  cmdutils: Pass the actual chosen encoder to filter_codec_opts
  os_support: Add fallback definitions for stat flags
  os_support: Rename the poll fallback function to ff_poll
  network: Check for struct pollfd
  os_support: Don't compare a negative number against socket descriptors
  os_support: Include all the necessary headers for the win32 open function
  x86: vc1: fix and enable optimised loop filter

Conflicts:
	cmdutils.c
	cmdutils.h
	ffmpeg.c
	ffplay.c
	libavformat/os_support.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-30 22:44:18 +02:00
Ronald S. Bultje 4f2c846d96 attributes: Add a definition of av_always_inline for MSVC
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 16:03:45 +03:00
Michael Niedermayer 5015c37b7d attributes: move av_restrict fallback from internal to attributes
This should fix --enable-hardcoded-tables

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-17 18:05:31 +02:00
J. Bohl fbed9317ff enable C99-external_inline for icl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-17 03:46:19 +02:00
Michael Niedermayer cd65cd8c5a revert "extern inline" usage
as it breaks ICC:
libavcodec/libavcodec.a(snowenc.o): In function `encode_q_branch':
/home/fate/x86_64-linux-gnu-icc-2011.4.191/src/libavcodec/snowenc.c:405: undefined reference to `ff_epzs_motion_search'
/home/fate/x86_64-linux-gnu-icc-2011.4.191/src/libavcodec/snowenc.c:414: undefined reference to `ff_get_mb_score'

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-15 10:29:13 +02:00
J. Bohl 0719e44b58 new attribute "extern inline" (fixing linker error with ff_get_mb_score and ff_get_mb_score)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-15 03:14:07 +02:00
Michael Niedermayer 6d4731e1f7 avutil: add av_noreturn
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-11 04:24:00 +01:00
Nicolas George fb1c30b71a lavu/attributes: introduce AV_NOWARN_DEPRECATED. 2011-09-25 11:18:41 +02:00
Michael Niedermayer 686959e87e Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doxygen: Consistently use '@' instead of '\' for Doxygen markup.
  Use av_printf_format to check the usage of printf style functions
  Add av_printf_format, for marking printf style format strings and their parameters
  ARM: enable thumb for Cortex-M* CPUs
  nsvdec: Propagate error values instead of returning 0 in nsv_read_header().
  build: remove SRC_PATH_BARE variable
  build: move basic rules and variables to main Makefile
  build: move special targets to end of main Makefile
  lavdev: improve feedback in case of invalid frame rate/size
  vfwcap: prefer "framerate_q" over "fps" in vfw_read_header()
  v4l2: prefer "framerate_q" over "fps" in v4l2_set_parameters()
  fbdev: prefer "framerate_q" over "fps" in device context
  bktr: prefer "framerate" over "fps" for grab_read_header()
  ALSA: implement channel layout for playback.
  alsa: support unsigned variants of already supported signed formats.
  alsa: add support for more formats.
  ARM: allow building in Thumb2 mode

Conflicts:
	common.mak
	doc/APIchanges
	libavcodec/vdpau.h
	libavdevice/alsa-audio-common.c
	libavdevice/fbdev.c
	libavdevice/libdc1394.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-24 03:07:04 +02:00
Martin Storsjö 67e9ae14d9 Add av_printf_format, for marking printf style format strings and their parameters
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-06-23 20:17:44 +03:00
Michael Niedermayer 2fd41c9067 Merge remote-tracking branch 'newdev/master'
* newdev/master:
  avio: make udp_set_remote_url/get_local_port internal.
  asfdec: also subtract preroll when reading simple index object
  matroskaenc: remove a variable that's unused after bc17bd9.
  avio: cosmetics - nicer vertical alignment.
  Remove unnecessary icc version checks
  Disable 'attribute "foo" ignored' warnings from icc
  rtsp: Don't use a locale dependent format string
  Add xd55 codec tag for XDCAM HD422 720p25 CBR files.
  configure: get libavcodec version from new version.h header
  lavc: move the version macros to a new installed header.
  matroskaenc: simplify get_aac_sample_rates by using ff_mpeg4audio_get_config
  Do not use format string "%0.3f" for RTSP Range field.
  Add apply_window_int16() to DSPContext with x86-optimized versions and use it in the ac3_fixed encoder.
  Document usage of import libraries created by dlltool
  configure: Set the correct lib target for arm/wince dlltool
  fate: simplify regression-funcs.sh
  fate: add support for multithread testing

Conflicts:
	libavformat/rtspdec.c
	libavutil/attributes.h
	libavutil/internal.h
	libavutil/mem.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-24 02:16:11 +01:00
Mans Rullgard 820818a330 Remove unnecessary icc version checks
With unknown attribute warnings disabled, these checks are no
longer needed.  Removing them improves readability while having
no effect on generated code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-23 12:39:58 +00:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Carl Eugen Hoyos a5b13b1423 Use macro __INTEL_COMPILER instead of __ICC.
__ICC is not supported on all platforms, this is an Intel documentation
bug that is supposed to be fixed in a future release.
(Intel issue 612289)
2011-03-02 13:38:21 +01:00
Mans Rullgard 0374152f89 Rename attribute_used to av_used and move it to attributes.h
This is consistent with most of the other attribute macros.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 365e3c7878)
2011-01-31 18:25:48 +01:00
Mans Rullgard 365e3c7878 Rename attribute_used to av_used and move it to attributes.h
This is consistent with most of the other attribute macros.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-31 16:01:26 +00:00
Carl Eugen Hoyos 086e997e34 Intel C compiler 12.0 does not suport these attributes: may_alias, force_align_arg_pointer and alloc_size.
Originally committed as revision 25716 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-11-10 12:45:41 +00:00
Michael Niedermayer a74d707cb7 av_alias is an attribute and belongs to attributes.h
also attributes.h is public and external api and can thus not depend
on configure tested compiler support thus this part is removed. A
different solution must be found if this breaks for some compiler
which i hope it does not.

Originally committed as revision 23115 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-13 16:30:58 +00:00
Diego Biurrun ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Michael Niedermayer 4ed39eedca av_builtin_constant_p()
Originally committed as revision 22770 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-02 01:03:27 +00:00
Måns Rullgård 2791730dbf Move gcc attribute macros to new header libavutil/attributes.h
Originally committed as revision 22346 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-08 21:28:56 +00:00