Home | History | Annotate | Line # | Download | only in lint1
d_alignof.c revision 1.4
      1  1.4  rillig /*	$NetBSD: d_alignof.c,v 1.4 2022/05/12 00:18:35 rillig Exp $	*/
      2  1.2  rillig # 3 "d_alignof.c"
      3  1.2  rillig 
      4  1.3  rillig /* https://gcc.gnu.org/onlinedocs/gcc/Alignment.html */
      5  1.3  rillig 
      6  1.3  rillig unsigned long
      7  1.3  rillig leading_and_trailing_alignof_type(void)
      8  1.1  jruoho {
      9  1.1  jruoho 	return __alignof__(short);
     10  1.1  jruoho }
     11  1.3  rillig 
     12  1.3  rillig unsigned long
     13  1.3  rillig leading_alignof_type(void)
     14  1.3  rillig {
     15  1.3  rillig 	return __alignof(short);
     16  1.3  rillig }
     17  1.3  rillig 
     18  1.3  rillig unsigned long
     19  1.3  rillig plain_alignof_type(void)
     20  1.3  rillig {
     21  1.3  rillig 	/* The plain word 'alignof' is not recognized by GCC. */
     22  1.4  rillig 	/* expect+2: error: function 'alignof' implicitly declared to return int [215] */
     23  1.4  rillig 	/* expect+1: error: syntax error 'short' [249] */
     24  1.3  rillig 	return alignof(short);
     25  1.3  rillig }
     26  1.4  rillig /* expect-1: warning: function plain_alignof_type falls off bottom without returning value [217] */
     27  1.3  rillig 
     28  1.3  rillig unsigned long
     29  1.3  rillig leading_and_trailing_alignof_expr(void)
     30  1.3  rillig {
     31  1.3  rillig 	/* FIXME: '__alignof__' must be recognized. */
     32  1.3  rillig 	/* FIXME: '__alignof__ expr' must be recognized. */
     33  1.3  rillig 	/* expect+1: error: syntax error '3' [249] */
     34  1.3  rillig 	return __alignof__ 3;
     35  1.3  rillig }
     36  1.3  rillig /* expect-1: warning: function leading_and_trailing_alignof_expr falls off bottom without returning value [217] */
     37  1.3  rillig 
     38  1.3  rillig unsigned long
     39  1.3  rillig leading_alignof_expr(void)
     40  1.3  rillig {
     41  1.3  rillig 	/* FIXME: '__alignof expr' must be recognized. */
     42  1.3  rillig 	/* expect+1: error: syntax error '3' [249] */
     43  1.3  rillig 	return __alignof 3;
     44  1.3  rillig }
     45  1.3  rillig /* expect-1: warning: function leading_alignof_expr falls off bottom without returning value [217] */
     46  1.3  rillig 
     47  1.3  rillig unsigned long
     48  1.3  rillig plain_alignof_expr(void)
     49  1.3  rillig {
     50  1.3  rillig 	/* The plain word 'alignof' is not recognized by GCC. */
     51  1.4  rillig 	/* expect+2: error: 'alignof' undefined [99] */
     52  1.3  rillig 	/* expect+1: error: syntax error '3' [249] */
     53  1.3  rillig 	return alignof 3;
     54  1.3  rillig }
     55  1.3  rillig /* expect-1: warning: function plain_alignof_expr falls off bottom without returning value [217] */
     56