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