summaryrefslogtreecommitdiffstats
path: root/src/test/test-sizeof.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: move `unsigned` to the start of type declarationFrantisek Sumsal2022-02-101-2/+2
| | | | | | | | | | | | | | | | | Even though ISO C11 doesn't mandate in which order the type specifiers should appear, having `unsigned` at the beginning of each type declaration feels more natural and, more importantly, it unbreaks Coccinelle, which has a hard time parsing `long unsigned` and others: ``` init_defs_builtins: /usr/lib64/coccinelle/standard.h init_defs: /home/mrc0mmand/repos/systemd/coccinelle/macros.h HANDLING: src/shared/mount-util.c : 1: strange type1, maybe because of weird order: long unsigned ``` Most of the codebase already "complies", so let's fix the remaining "offenders".
* test-sizeof: show stack and heap randomizationZbigniew Jędrzejewski-Szmek2021-11-301-0/+8
| | | | It's useful to reassure yourself those those things actually work ;)
* test-sizeof: add intmax typesZbigniew Jędrzejewski-Szmek2021-11-181-0/+2
|
* timesync: fix wrong type for receiving timestamp in nanosecondsYu Watanabe2021-08-201-0/+2
| | | | Fixes #20482.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* test-sizeof: print pointer sizesZbigniew Jędrzejewski-Szmek2020-09-041-0/+11
| | | | | | | | | This is useful information, I don't know why we forgot to add it there. gcc doesn't like arithemetic on a pointer to a function or void*, so don't print signedness info there. It doesn't matter anyway. C says function pointers can be different... Though I guess our code isn't prepared for that.
* macro: introduce DISABLE_WARNING_TYPE_LIMITS and make use of it everywhereLennart Poettering2020-05-251-1/+1
|
* test-sizeof: print size socklen_tZbigniew Jędrzejewski-Szmek2020-03-021-0/+3
| | | | | | It returns 32 bits, unsigned on amd64, so it's probably similar everywhere with glibc. But let's make the code generic, without assuming specific size or signedness.
* Rework cpu affinity parsingZbigniew Jędrzejewski-Szmek2019-05-291-0/+3
| | | | | | | | | | | | | | | | | | The CPU_SET_S api is pretty bad. In particular, it has a parameter for the size of the array, but operations which take two (CPU_EQUAL_S) or even three arrays (CPU_{AND,OR,XOR}_S) still take just one size. This means that all arrays must be of the same size, or buffer overruns will occur. This is exactly what our code would do, if it received an array of unexpected size over the network. ("Unexpected" here means anything different from what cpu_set_malloc() detects as the "right" size.) Let's rework this, and store the size in bytes of the allocated storage area. The code will now parse any number up to 8191, independently of what the current kernel supports. This matches the kernel maximum setting for any architecture, to make things more portable. Fixes #12605.
* test-sizeof: print the alignments tooZbigniew Jędrzejewski-Szmek2019-02-051-5/+6
|
* test-sizeof: another aproach to _Float128 availability detectionZbigniew Jędrzejewski-Szmek2018-06-201-1/+4
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-3/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* test-sizeof: also print float types from ISO/IEC TS 18661-3Zbigniew Jędrzejewski-Szmek2018-06-051-0/+8
|
* test-sizeof: show that a small 64 field is not enough to force the enum to ↵Zbigniew Jędrzejewski-Szmek2018-05-221-1/+10
| | | | | | | | | | | | | | be 64 bits On both 32 and 64 bits, the result is: enum Enum → 32 bits, unsigned enum BigEnum → 32 bits, unsigned enum BigEnum2 → 64 bits, unsigned big_enum2_pos → 4 big_enum2_neg → 8 The last two lines show that even if the enum is 64 bit, and the field of an enum is defined with UINT64_C(), the field can still be smaller.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* log: minimize includes in log.hLennart Poettering2018-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* test-sizeof: also add uid_tZbigniew Jędrzejewski-Szmek2018-01-041-0/+1
| | | | We had gid_t, and pid_t, but not uid_t. Add for completeness.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* test-sizeof: add pid_t and gid_tZbigniew Jędrzejewski-Szmek2017-10-041-0/+2
| | | | C.f. #6975.
* test-sizeof: print the size of an enumZbigniew Jędrzejewski-Szmek2017-04-261-0/+11
|
* test-sizeof: add some struct-timespec related fieldsZbigniew Jędrzejewski-Szmek2017-03-301-0/+3
| | | | Might help with #5264.
* test-sizeof: do not link with libsystemd-sharedZbigniew Jędrzejewski-Szmek2017-03-301-5/+6
| | | | This makes it much quicker to compile.
* test-sizeof: add a helper which prints variable sizes and signednessZbigniew Jędrzejewski-Szmek2016-03-021-0/+53
This helps to understand misleading gcc warnings about type mismatches.