aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/macros.h
Commit message (Collapse)AuthorAgeFilesLines
* util: Rename PURE to ATTRIBUTE_PURE.Jose Fonseca2015-08-091-2/+2
| | | | | | | | | To avoid collission with windows.h's PURE macro. We could consider eventually renaming to __pure, but that would require further care, so it's left to the future. Reviewed-by: Brian Paul <[email protected]>
* mesa: Detect and provide macros for function attributes pure and const.Eric Anholt2015-07-171-0/+20
| | | | | | | | | | | | | These are really useful hints to the compiler in the absence of link-time optimization, and I'm going to use them in VC4. I've made the const attribute be ATTRIBUTE_CONST unlike other function attributes, because we have other things in the tree #defining CONST for their own unrelated purposes. v2: Alphabetize. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
* mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).Kenneth Graunke2015-07-061-0/+6
| | | | | | | | | In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util/macros: Move DIV_ROUND_UP to util/macros.hAxel Davy2015-04-291-0/+2
| | | | | | | Move DIV_ROUND_UP to a shared location accessible everywhere Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* Add macro for unused function attribute.Vinson Lee2015-03-091-0/+6
| | | | | | Suggested-by: Emil Velikov <[email protected]> Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: rework _MSC_VER >= 1200 checksEmil Velikov2015-03-061-5/+3
| | | | | | | | | Replace the _MSC_VER >= 1200 with defined (_MSC_VER) and compact if/else statements. We require MSVC 2008 or later with commit 46110c5d564. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: consolidate PUBLIC macro definitionBrian Paul2015-03-041-0/+23
| | | | | | | Define the macro in src/util/macros.h rather than in two different places. Note that USED isn't actually used anywhere at this time. Reviewed-by: Jose Fonseca <[email protected]>
* Revert "util: Move the alternate fpclassify implementation to util"Jason Ekstrand2015-01-281-62/+0
| | | | | | | | | | | | | This reverts commits d6eb572905e39c36168b8f5da240af961f9dde0a and 58e8468d113c7d3d4a59ea4a8d70fd45b78e85e6. This is no longer necessary as we aren't using it in NIR anymore. Also, it broke the build on some strange systems so let's put it back in querymatrix where it came from. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88852 Acked-by: Matt Turner <[email protected]>
* util: Predicate the fpclassify fallback on !defined(__cplusplus)Jason Ekstrand2015-01-281-2/+12
| | | | | | | | | | | The problem is that the fallbacks we have at the moment don't work in C++. While we could theoretically fix the fallbacks it would also raise the issue of correctly detecting the fpclassify function. So, for now, we'll just disable it until we actually have a C++ user. Reported-by: Tom Stellard <[email protected]> Tested-by: Tom Stellard <[email protected]> Tested-by: EdB <[email protected]>
* util: Move the alternate fpclassify implementation to utilJason Ekstrand2015-01-281-0/+52
| | | | Reviewed-by: Ian Romanick <[email protected]>
* util: Make unreachable at least be an assertCarl Worth2015-01-161-1/+1
| | | | | | | | Previously, if __builtin_unreachable() was unavailable, the unreachable macro was defined to do nothing. We do better here, by at least still making it an assert. Reviewed-by: Ian Romanick <[email protected]>
* util: Implement assume() for clang.Matt Turner2014-11-241-1/+11
| | | | Reviewed-by: Jordan Justen <[email protected]>
* util: Implement unreachable for MSVC using __assumeIan Romanick2014-11-051-0/+6
| | | | | | | | | Based on the description of __assume at: http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* util: Add assume() macro.Matt Turner2014-10-231-0/+14
| | | | Reviewed-by: Ian Romanick <[email protected]>
* ralloc: Mark ralloc functions with gcc's malloc attribute.Matt Turner2014-09-251-0/+6
| | | | | | | Cuts a few hundred bytes from the DRI drivers, so it must give gcc some extra information. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Replace a priori knowledge of gcc attributes with configure tests.Matt Turner2014-09-251-4/+7
| | | | | | | | Note that I had to add support for testing the packed attribute to m4/ax_gcc_func_attribute.m4. Reviewed-by: Jason Ekstrand <[email protected]> [C bits] Reviewed-by: Ian Romanick <[email protected]>
* mesa: Replace a priori knowledge of gcc builtins with configure tests.Matt Turner2014-09-251-11/+3
| | | | | | | | | | | | | | Presumbly this will let clang and other compilers use the built-ins as well. Notice two changes specifically: - in _mesa_next_pow_two_64(), always use __builtin_clzll and add a static assertion that this is safe. - in macros.h, remove the clang-specific definition since it should be able to detect __builtin_unreachable in configure. Reviewed-by: Jason Ekstrand <[email protected]> [C bits] Reviewed-by: Ian Romanick <[email protected]>
* util: Gather some common macrosJason Ekstrand2014-08-041-0/+128
This gathers macros that have been included across components into util so that the include chain can be more vertical. In particular, this makes util stand on its own without any dependence whatsoever on the rest of mesa. Signed-off-by: "Jason Ekstrand" <[email protected]> Reviewed-by: Marek Olšák <[email protected]>