/* $NetBSD: lex_integer.c,v 1.11 2023/03/28 14:44:34 rillig Exp $ */ # 3 "lex_integer.c" /* * Tests for lexical analysis of integer constants. * * C99 6.4.4.1 "Integer constants" */ /* lint1-only-if: lp64 */ /* lint1-extra-flags: -X 351 */ long signed_long; unsigned long long unsigned_long_long_var; struct s { int member; }; /* * When lint tries to convert the argument to 'struct s', it prints the * actual type of the argument as a side effect. */ void print_type(struct s); void no_suffix(void) { /* expect+1: ... passing 'int' ... */ print_type(0); /* The '-' is not part of the constant, it is a unary operator. */ /* expect+1: ... passing 'int' ... */ print_type(-1); /* expect+1: ... passing 'int' ... */ print_type(2147483647); /* expect+1: ... passing 'int' ... */ print_type(0x7fffffff); /* expect+1: ... passing 'int' ... */ print_type(017777777777); /* expect+1: ... passing 'unsigned int' ... */ print_type(0x80000000); /* expect+1: ... passing 'unsigned int' ... */ print_type(020000000000); /* expect+1: ... passing 'unsigned int' ... */ print_type(0xffffffff); /* expect+1: ... passing 'long' ... */ print_type(2147483648); /* expect+1: ... passing 'long' ... */ print_type(0x0000000100000000); /* expect+1: ... passing 'long' ... */ print_type(0x7fffffffffffffff); /* expect+1: ... passing 'unsigned long' ... */ print_type(0x8000000000000000); /* expect+1: ... passing 'unsigned long' ... */ print_type(0xffffffffffffffff); /* expect+2: warning: integer constant out of range [252] */ /* expect+1: ... passing 'unsigned long' ... */ print_type(0x00010000000000000000); } void suffix_u(void) { /* expect+1: ... passing 'unsigned int' ... */ print_type(3U); /* expect+1: ... passing 'unsigned int' ... */ print_type(3u); /* expect+1: ... passing 'unsigned int' ... */ print_type(4294967295U); /* expect+1: ... passing 'unsigned long' ... */ print_type(4294967296U); } void suffix_l(void) { /* expect+1: ... passing 'long' ... */ print_type(3L); /* expect+1: ... passing 'long' ... */ print_type(3l); } void suffix_ul(void) { /* expect+1: ... passing 'unsigned long' ... */ print_type(3UL); /* expect+1: ... passing 'unsigned long' ... */ print_type(3LU); } void suffix_ll(void) { /* expect+1: ... passing 'long long' ... */ print_type(3LL); /* The 'Ll' must not use mixed case. Checked by the compiler. */ /* expect+1: ... passing 'long long' ... */ print_type(3Ll); /* expect+1: ... passing 'long long' ... */ print_type(3ll); } void suffix_ull(void) { /* expect+1: ... passing 'unsigned long long' ... */ print_type(3llu); /* expect+1: ... passing 'unsigned long long' ... */ print_type(3Ull); /* The 'LL' must not be split. Checked by the compiler. */ /* expect+1: ... passing 'unsigned long long' ... */ print_type(3lul); /* The 'Ll' must not use mixed case. Checked by the compiler. */ /* expect+1: ... passing 'unsigned long long' ... */ print_type(3ULl); } void suffix_too_many(void) { /* expect+2: warning: malformed integer constant [251] */ /* expect+1: ... passing 'long long' ... */ print_type(3LLL); /* expect+2: warning: malformed integer constant [251] */ /* expect+1: ... passing 'unsigned int' ... */ print_type(3uu); } /* https://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html */ void binary_literal(void) { /* This is a GCC extension, but lint doesn't know that. */ /* expect+1: ... passing 'int' ... */ print_type(0b1111000001011010); /* expect+1: ... passing 'unsigned int' ... */ print_type(0b11110000111100001111000011110000); } 917a55c5918f64997490e1c'>Minor cleanup: use bitfields instead of a flags word for private statedholland 2012-04-07use getfsspecname()christos 2012-02-13Update dangling references to quotactl(2), mostly now libquota(3), and todholland 2012-02-01libquota no longer requires libprop. Also remove some other no-longer-useddholland 2012-01-30Remove dependence on quotaprop.h, also quotautil.c (no longer used).dholland 2012-01-30Rely on libquota for fallback to direct access of old-style quota files.dholland 2012-01-30Remove references to -D option.dholland 2012-01-30Don't use the old getvfsquota() here.dholland 2012-01-29Rename static inline "helper" functions:dholland 2012-01-29Change dqblk_to_quotaval() from quota1_subr.c to dqblk_to_quotavals(),dholland 2012-01-09"quotaclass" -> "idtype". After lengthy wrangling on the mailing listsdholland 2012-01-09Use quota_put() and quota_delete() to update quotas instead of makingdholland 2011-11-25Rename struct ufs_quota_entry -> struct quotaval.dholland 2011-11-13Split up excessively large main().dholland 2011-11-13Cleanup for edquota.dholland 2011-09-30Fix an implementation inconsistency with the prop_*_send_syscall() andjym 2011-07-10Minor cosmetic fixes, no semantic changes. (object file diffs have beendholland 2011-07-10tsort contents of file.dholland 2011-07-10use __deaddholland 2011-03-24Add a new libquota library, which contains some blocks to build and/orbouyer 2011-03-06- KNFchristos 2011-03-06Split "file system" like usual. Improve SYNOPSIS. Various other fixes.wiz 2011-03-06merge the bouyer-quota2 branch. This adds a new on-disk formatbouyer 2008-07-21Remove the \n and tabs from the __COPYRIGHT() strings.lukem 2008-05-02WARNS=4 love.xtraeme 2006-05-26Coverity CID 3785: calling fclose() twice on same file pointerjnemeth 2006-05-23Coverity CID 3227, 3226: Don't leak fd'schristos 2004-01-05Homogenize usage messages: make the 'usage' word all lowercase, as this seemsjmmv 2003-08-07Move UCB-licensed code from 4-clause to 3-clause licence.agc 2003-02-25.Nm does not need a dummy argument ("") before punctuation orwiz 2003-01-31Switch soft and hard, per PR 20135.wiz 2002-12-05Fix the way $EDITOR is started so the variable can have flags in additionjonb 2002-12-04Add new command-line flags, which ease edquota use in bach scripts:bouyer 2002-01-19Whitespace nit, sort sections.wiz 2000-04-14Don't declare 'extern opt*' getopt variables.simonb 2000-01-21Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We getmycroft 1999-12-16Explicitely cast to (u_quad_t) calls to btodb() and dbtob() to avoidbouyer 1999-08-16Spell "privilege" correctly (correct spelling from Jonathan Stone).simonb 1998-03-30remove unused extern.mrg 1997-10-21fix compile warning on the sparc (erik fair).mrg 1997-10-17WARNSify, deprecate bcmp/perror et al in favour of memcmp/err* et allukem 1997-08-25Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,kleink 1997-05-29Fix broken uses of Dd. Both the mdoc and mdoc.samples pages agree:cgd