e3440f3861208b263b31912bf4c81e04b7f22c62 |
|
22-Jan-2018 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: cast {,CONST_}PTR_OFFSET's offset argument to size_t
This fixes build on 32-bit systems where the addition may cause integer
promotion to an integer type larger than uintptr_t.
gcc 6.3.0 warning:
file-cache.c: In function 'file_cache_write':
macros.h:25:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
((void *) (((uintptr_t) (ptr)) + (offset))) |
ac7aa955db4c77bbb169baa5d104a4c128674646 |
|
17-Jan-2018 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib: Use uintptr_t in PTR_OFFSET and POINTER_CAST
Use uintptr_t instead of pointers.
Fixes clang 6.0 warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension |
713e3ec4daebf5e0a4057f925ed1aeb5766debd8 |
|
05-Oct-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: move i_fd_close*() to fd-util.[ch] |
c25d75b24ae0dcc0ab9081c389bbfc733d53ba63 |
|
03-Oct-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: introduce i_close_fd_path()
It is like i_close_fd() but takes an argument with the name of the file
that's being closed. The name is only used when printing the error
message due to a failed close() syscall. |
ad81591e3c6b8824c7662122dc5d10f853a8e82a |
|
03-Oct-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: improve i_close_fd() error message
In addition to printing the file and line number, we can print the
actual arg passed in as well as the function calling i_close_fd(). |
b93dba1fdb1850e3c2706a40fd78450d555d8d9a |
|
03-Oct-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: print correct error string on i_close_fd() failure
close_keep_errno() preserved the original errno, therefore the %m in
i_close_fd()'s error message printed an unrelated error string. |
e2e9ea6da9f3db5fd7fe467db79232d20d03832f |
|
22-Sep-2017 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Define i_unreached() to __builtin_unreachable() with STATIC_CHECKER
This helps clang's alpha.deadcode.UnreachableCode checker. |
95ec0fd4789bd249b106e282a32a08f4d1827f63 |
|
19-Sep-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: i_close_fd(-1) should be a no-op |
1c238d4b71b43ba80cf4b9b3c3e797f2b25ec23c |
|
07-Sep-2017 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
lib: introduce container_of
This is a simple but type safe implementation. |
d31018c559908103c3ecb565101b556b1e9ecef4 |
|
17-Aug-2017 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Fix compiler warning about mixing boolean with multiplication |
3aff91a1941ea35265f1e80e70853693e8ec8e0b |
|
06-Jul-2017 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib, lib-storage: Move INOTIFY_ST_CHANGED to ST_CHANGED in lib
Allows reusing this elsewhere |
d16199fcc9bbb61b8e47e69c3893161b363d9a17 |
|
07-Apr-2017 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Add a common HAVE_TYPE_CHECKS
I'm not sure if it should be checking gcc >= 3.0 or 3.3, but they're
all old so doesn't really matter.
The __cplusplus check was added to both, since it wouldn't have done
anything anyway as COMPILE_ERROR_IF_TRUE() is 0 for __cplusplus. |
08cb8e0ae115be975be66fffe7a4c0ffaee8223e |
|
24-Dec-2016 |
Stephan Bosch <stephan.bosch@dovecot.fi> |
lib: Created i_zero() wrapper for memset(p, 0, sizeof(*p)).
Also creates an i_zero_safe() version for safe_memset(). |
dc38a5b101102ec57da9e25e6b80561ead3f54f8 |
|
05-Dec-2016 |
Phil Carmody <phil@dovecot.fi> |
lib/macros.h - protect old compilers from use of modern features
no_sanitize(integer) is not in 3.5 (debian stable's version), but is
documented in 3.9. Exactly when it appeared isn't immediately obvious.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
08b888317593761402ffb2635290de24b53d7980 |
|
24-Nov-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Add ATTR_UNSIGNED_WRAPS for disabling clang -fsanitize=integer |
8638c3723e3d4dfe921d0f8a1fc844a9ed79d5d3 |
|
14-Nov-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Assert-crash in i_close_fd() if fd == 0
lib-master now guarantees that fd==0 doesn't normally happen. |
4ab8814199f67c28b30f6aeef77d045fc856dc30 |
|
02-Nov-2016 |
Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi> |
use __func__ instead of __FUNCTION__
__FUNCTION__ is a non-standard extension while __func__ is C99. |
f54d511597447e40f5413716c10520a7229364f1 |
|
01-Jul-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Fix to compiling STATIC_ARRAY in C++ code |
bc3586bca89b79dfccdd3c155d80d5082aabc07b |
|
01-Jul-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
configure: Check if C99 "static" keyword is supported for array sizes. |
a5286dc8a017c8adbcd243b61dd5051e8012d40b |
|
06-Jun-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: define FALSE to be (!1)
This allows the patched clang to treat FALSE as a boolean expression. |
23bdbb7b1831785c6ba6df190f6369da882d2b9d |
|
06-Jun-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
global: Require comparisons to be strict boolean expressions
* No implicit integer -> boolean or pointer -> boolean conversions
* !expr can be used only if expr is boolean type
These were checked with a patched clang. It found various actual bugs,
which were fixed by the previous commits. |
9625595c47c665f5aee57ebfcb1fcbe9ad1bf3a0 |
|
31-May-2016 |
Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi> |
[LEN] to [static LEN] on some function parameters
Also add STATIC_ARRAY macro to hide it in c++ compilation. |
52d50af43352e0e4d267e33076eb841bb61ad8a2 |
|
03-Feb-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: Avoid typeof() if HAVE_TYPEOF isn't set, even if gcc version is high enough.
This is mainly to test that we can compile without typeof(). |
255c47a461434ac075efa4fd481d888f193b73ba |
|
10-Jul-2014 |
Timo Sirainen <tss@iki.fi> |
lib: Added fd=-1 assert to i_close_fd() macro.
This way we'll see clearly where it fails, instead of just seeing assert in
close_keep_errno() without an easy way to see where it crashed. |
17654607d6adbe64923f023a7120627544c540c8 |
|
16-Jun-2014 |
Timo Sirainen <tss@iki.fi> |
lib: Use __attribute__((returns_nonnull)) for the common memory/string functions.
Also added a couple of missing ATTR_MALLOCs. |
7df0ae570da81b27ac551673f373b1260edf1c56 |
|
09-Jun-2014 |
Phil Carmody <phil@dovecot.fi> |
lib: Fix MEM_ALIGN to cope with huge allocations
Attempting to allocate 2^32+1 bytes will look like it succeeds, as MEM_ALIGN
will set alloc_size = 8. The caller will then think it's got 4 gig to play
with.
e.g. t_malloc0 will wipe vast areas of memory before segfaulting, which might
include useful information we'd like in a corefile.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
93dbad4bfd3347f6451d217cc9e115f9f0bf9f40 |
|
04-Sep-2013 |
Timo Sirainen <tss@iki.fi> |
i_close_fd() didn't handle errors correctly with gcc. |
f154234cb065444b54eef8cf3b6967e3e0968ae9 |
|
29-May-2013 |
Timo Sirainen <tss@iki.fi> |
Fixed compiling with gcc v3.3 and older.
Perhaps the check needs to be also for somewhat newer versions?.. |
e37aed073e70daf34e3791a01f232810626208e8 |
|
25-Feb-2013 |
Timo Sirainen <tss@iki.fi> |
Reverted the recent hash.h changes. Instead use -Wno-duplicate-decl-specifier with clang.
The modified version required hash table users to know the structs'
contents, which isn't otherwise necessary. |
6d803d271cbc63ae3733824dfd96c75d65068fa1 |
|
24-Feb-2013 |
Timo Sirainen <tss@iki.fi> |
Fixed "duplicate const" warnings with new clang. |
d00f983f78274192b9b312178a81a209ffbd4e15 |
|
24-Feb-2013 |
Timo Sirainen <tss@iki.fi> |
Use proper HAVE_TYPEOF check instead of checking with gcc versions. |
27a44fcfd8d19bffe0f267f20a2b5d3fe7600fdd |
|
19-Aug-2012 |
Timo Sirainen <tss@iki.fi> |
Removed CONTEXT_TYPE_SAFETY macro and reimplemented its functionality better.
gcc/clang now gives a compiler error in many places if callback isn't
exactly what was expected. It's also now much easier to add more of these
checks. |
678d0463849ba777106eb7875f27db07a5d8e3df |
|
19-Aug-2012 |
Timo Sirainen <tss@iki.fi> |
Hash table API is now (mostly) type safe. |
4307c886579381dbb1897ea1388ae6978c96f560 |
|
27-Jun-2012 |
Timo Sirainen <tss@iki.fi> |
Changed i_close_fd() API to set the fd to -1 after closing. |
cb78bd2ad54e402c1f53930b41e2295683bda90b |
|
25-Jun-2012 |
Timo Sirainen <tss@iki.fi> |
Replaced (void)close(fd) and close_keep_errno() with i_close_fd().
i_close_fd() preserves the errno and logs an error if the close() fails. |
61409be78f1b5d9c4173751efc57845902418745 |
|
25-Jun-2012 |
Timo Sirainen <tss@iki.fi> |
Added ATTR_NOWARN_UNUSED_RESULT, which expands to nowarn_unused_result attribute if supported.
Requires a patched clang. |
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4 |
|
23-Jun-2012 |
Timo Sirainen <tss@iki.fi> |
Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
The non-obvious APIs where NULL parameter was changed to "" are
master_service_init() and auth_master_user_list_init().
These checks can currently be enabled only on a patched clang:
http://llvm.org/bugs/show_bug.cgi?id=6786 |
c3c07d6527ad28c8546cbbf84c257d178e23c184 |
|
10-Jan-2012 |
Timo Sirainen <tss@iki.fi> |
Added t_strflocaltime(). |
a5abb99ca9d1756d6ccef757b6e1f3865dd66a10 |
|
30-Oct-2011 |
Dennis Schridde <devurandom@gmx.net> |
Add DOVECOT_PREREQ to src/lib/macros.h - convenience macro to test the version of dovecot |
14609d1c87526f49c831d965ebf1720f2e28fcee |
|
06-Dec-2010 |
Timo Sirainen <tss@iki.fi> |
Removed unused BITS_IN_UINT and CLAMP macros. |
92550656e08f70674c5233de23ec50a107accfd9 |
|
06-Dec-2010 |
Timo Sirainen <tss@iki.fi> |
Unexpand BITS_IN_SIZE_T in the only place it's used and remove the macro. |
65b15c350a5bcb5f927280481a1e73abb600efba |
|
06-Dec-2010 |
Timo Sirainen <tss@iki.fi> |
Moved a global NVL() macro to the few places in lib-imap where it was actually used. |
8350e90ac768b5a9858098a446af8f270baaceee |
|
27-Mar-2010 |
Timo Sirainen <tss@iki.fi> |
Added CONST_STRUCT_MEMBER_P() and removed unused (broken) STRUCT_MEMBER().
--HG--
branch : HEAD |
16d913e621788f97ac0d2bf60d9f8bf837c292d9 |
|
22-Mar-2010 |
Timo Sirainen <tss@iki.fi> |
Asserts now use __FUNCTION__ instead of __PRETTY_FUNCTION__.
With gcc these had the same output, but clang's __PRETTY_FUNCTION__ returns
a larger output that's not useful.
--HG--
branch : HEAD |
227030181d9881683663b76da40616c2caa0ea6b |
|
22-Mar-2010 |
Timo Sirainen <tss@iki.fi> |
Removed unused GNUC_FUNCTION* macros.
--HG--
branch : HEAD |
cee00f173e09468dad533a9c317244d43b794603 |
|
31-Jan-2010 |
Timo Sirainen <tss@iki.fi> |
Added CONTEXT_CALLBACK2() helper macro.
--HG--
branch : HEAD |
7bafda1813454621e03615e83d55bccfa7cc56bd |
|
04-Dec-2009 |
Timo Sirainen <tss@iki.fi> |
Removed MEMBER() macro. Require C99 style struct initializer.
--HG--
branch : HEAD |
7ee43613f6d5225fecae31f174c197a279f48e82 |
|
29-Sep-2009 |
Timo Sirainen <tss@iki.fi> |
Added ATTR_HOT and ATTR_COLD macros. Use them in a couple of places.
--HG--
branch : HEAD |
69d87bf7d0a976a3c6ab8b9760cfc5c8a5f30bf3 |
|
20-Jun-2008 |
Timo Sirainen <tss@iki.fi> |
Added ATTR_PURE macro, which expands to pure attribute if available.
--HG--
branch : HEAD |
985d62e1f840dc43f6069d521ee05cc93f40eb54 |
|
13-Jun-2008 |
Timo Sirainen <tss@iki.fi> |
MEMBER(): Don't try to use the C99 "." feature with HP-UX.
--HG--
branch : HEAD |
8939d20e53167fe5f308d41154085d1e0bbcf82a |
|
31-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
Use malloc attribute, __builtin_expect() and __builtin_types_compatible_p()
only with new enough gccs. Patch by Sven Anderson.
--HG--
branch : HEAD |
ba96945f3ae2e6f128d5f1d43f8fd3db5313d951 |
|
26-Nov-2007 |
Timo Sirainen <tss@iki.fi> |
unlikely() and likely() were broken with non-gcc.
--HG--
branch : HEAD |
e325151a50d56accbc8ccbef4436d424007e3879 |
|
11-Nov-2007 |
Timo Sirainen <tss@iki.fi> |
Added likely() and unlikely() macros. Use unlikely() with asserts.
--HG--
branch : HEAD |
43d32cbe60fdaef2699d99f1ca259053e9350411 |
|
16-Sep-2007 |
Timo Sirainen <tss@iki.fi> |
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
--HG--
branch : HEAD |
c25356d5978632df6203437e1953bcb29e0c736f |
|
16-Sep-2007 |
Timo Sirainen <tss@iki.fi> |
Changed .h ifdef/defines to use <NAME>_H format.
--HG--
branch : HEAD |
8e4eac16ace0fab781f3bc74352173800a28f52e |
|
20-Jul-2007 |
Timo Sirainen <tss@iki.fi> |
Added N_ELEMENTS() macro.
--HG--
branch : HEAD |
6fa13ad5ca9582b8dfd7bc9fdcff43569a594775 |
|
04-Jun-2007 |
Timo Sirainen <tss@iki.fi> |
Added missing __attr_*__ macros for non-GCC compilers.
--HG--
branch : HEAD |
63b6f8628b2d757fbf02281f30d865d0ccf44f1f |
|
29-Mar-2007 |
Timo Sirainen <tss@iki.fi> |
Added HAVE_TYPEOF, COMPILE_ERROR_IF_TRUE() and
COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE() macros.
--HG--
branch : HEAD |
220a5d63606d4e0d0db2ccdd810b2191fc256146 |
|
22-Feb-2007 |
Timo Sirainen <tss@iki.fi> |
warn_unused_result attribute exists only with gcc 4.0 and later.
--HG--
branch : HEAD |
00efa7d99981e18e286c02b18c1163dde18ee521 |
|
15-Dec-2006 |
Timo Sirainen <tss@iki.fi> |
Type safe callbacks weren't as easy as I thought. Only callback(void
*context) can be handled generically. Others can be handled specially, but
only if all the parameters are pointers, otherwise eg. int parameter can be
replaced with long without compiler giving any warnings.
--HG--
branch : HEAD |
59151b71059df1190acd75d8717ed04a7920c862 |
|
15-Dec-2006 |
Timo Sirainen <tss@iki.fi> |
Added context parameter type safety checks for most callback APIs.
--HG--
branch : HEAD |
c89624ed00aac298d51301489a1952b79796f999 |
|
18-Nov-2006 |
Timo Sirainen <tss@iki.fi> |
Define __attrs_used__ if the compiler actually supports attributes.
--HG--
branch : HEAD |
cf37950c9d817a66e0f6a9064b3194c677f23b0b |
|
01-Nov-2006 |
Timo Sirainen <tss@iki.fi> |
Use malloc attribute for the most commonly used memory and string allocation
functions. Use warn_unused_result attribute for reallocs.
--HG--
branch : HEAD |
6a058aa8c986a8fbec5ddd72c141db9df0b64b2d |
|
01-Nov-2006 |
Timo Sirainen <tss@iki.fi> |
Added sentinel GCC attribute to *_strconcat() functions. Added
format printf-attribute to vprintf-type functions.
--HG--
branch : HEAD |
078d83c8390efde1bb051ae9d0cc3481fc13c081 |
|
16-Oct-2004 |
Timo Sirainen <tss@iki.fi> |
i_unreached(): show also file and line number in error message
--HG--
branch : HEAD |
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834 |
|
27-Apr-2004 |
Timo Sirainen <tss@iki.fi> |
importing new index code. mbox still broken.
--HG--
branch : HEAD |
4a76ce0661f0938d45caf640df3cb294ac55c16c |
|
28-Apr-2003 |
Timo Sirainen <tss@iki.fi> |
Added __attr_scanf__
--HG--
branch : HEAD |
c856e87cf8e535c3ecf351fa28d7553c7ca9994a |
|
30-Jan-2003 |
Timo Sirainen <tss@iki.fi> |
Removed STRUCT_OFFSET, offsetof() is ANSI-C for the same purpose. Added
MEMBER() macro to define C99-style struct labels.
--HG--
branch : HEAD |
9a468881be203e99e0136e88011396ae449eef5d |
|
28-Jan-2003 |
Timo Sirainen <tss@iki.fi> |
No i_memmove here, just memmove.
--HG--
branch : HEAD |
c0435c854a0e7246373b9752d163095cc4fbe985 |
|
05-Jan-2003 |
Timo Sirainen <tss@iki.fi> |
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.
--HG--
branch : HEAD |
721f01ebcbe4403e3f0ea2e6071cf285b0577507 |
|
04-Jan-2003 |
Timo Sirainen <tss@iki.fi> |
If PEDANTIC is defined, don't use (void)(..) with STMT_START/END.
--HG--
branch : HEAD |
6defed8fef1781cb1d34353784232e87c19f173b |
|
27-Dec-2002 |
Timo Sirainen <tss@iki.fi> |
We weren't using va_list properly, especially gcc/PowerPC didn't like it.
--HG--
branch : HEAD |
ca8863af6ce6b695a369dfb7b50e909420dc45df |
|
04-Nov-2002 |
Timo Sirainen <tss@iki.fi> |
Several minor fixes: signess, casting away const, missing static, etc.
--HG--
branch : HEAD |
bb30dbdec689323ec145242403a11d54f8ff90b9 |
|
28-Oct-2002 |
Timo Sirainen <tss@iki.fi> |
Added --enable-asserts (default) and fixed some warnings when building
without. Added i_unreached() to indicate supposedly unreachable code block
and changed a existing i_assert(0) calls to it. Removed return_if_fail() and
return_val_if_fail() macros, they're not useful.
--HG--
branch : HEAD |
664c7007d4a0116be2cce62295cd9fb9cd33eee0 |
|
08-Sep-2002 |
Timo Sirainen <tss@iki.fi> |
Replaced INT_TO_POINTER and POINTER_TO_INT macros with POINTER_CAST and
POINTER_CAST_TO macros, the CAST_TO takes a parameter to which type we're
casting to. Also POINTER_CAST should be valid ANSI-C now.
--HG--
branch : HEAD |
8520b355cedfb8098f51ba3dfa29d7daa867a9df |
|
08-Sep-2002 |
Timo Sirainen <tss@iki.fi> |
more size_t fixes.
--HG--
branch : HEAD |
f68187c399102c110bf10683a2a554adc64f0d20 |
|
08-Sep-2002 |
Timo Sirainen <tss@iki.fi> |
nearest_power() uses now size_t.
--HG--
branch : HEAD |
88d7593652b331695a219a0e07124b7c82e3835c |
|
08-Sep-2002 |
Timo Sirainen <tss@iki.fi> |
Better fix for POINTER_TO_UINT
--HG--
branch : HEAD |
772a217e4c61292cb7d4a00253ad8dc6dcfda825 |
|
08-Sep-2002 |
Timo Sirainen <tss@iki.fi> |
POINTER_TO_UINT() fixed to not give warnings with 64bit pointers.
--HG--
branch : HEAD |
66251e6ab31e5cc153fe5cae608e416dacafe9cd |
|
08-Aug-2002 |
Timo Sirainen <tss@iki.fi> |
Initial revision
--HG--
branch : HEAD |