Home | History | Annotate | Line # | Download | only in lint1
d_c99_complex_split.c revision 1.6
      1 /*	$NetBSD: d_c99_complex_split.c,v 1.6 2021/04/09 21:07:39 rillig Exp $	*/
      2 # 3 "d_c99_complex_split.c"
      3 
      4 /*
      5  * Checks that the real and imaginary parts of a complex number can be
      6  * accessed (since C99).
      7  */
      8 
      9 int
     10 b(double a)
     11 {
     12 	return a == 0;
     13 }
     14 
     15 void
     16 a(void)
     17 {
     18 	double _Complex z = 0;
     19 	if (b(__real__ z) && b(__imag__ z))
     20 		return;
     21 }
     22 
     23 void sink(double _Complex);
     24 
     25 void
     26 set_complex_complete(double re, double im)
     27 {
     28 	double _Complex c;
     29 
     30 	__real__ c = re; /* FIXME *//* expect: may be used before set */
     31 	__imag__ c = im;
     32 	sink(c);
     33 }
     34 
     35 void
     36 set_complex_only_real(double re)
     37 {
     38 	double _Complex c;
     39 
     40 	__real__ c = re; /* FIXME *//* expect: may be used before set */
     41 	/* __imag__ c is left uninitialized */
     42 	sink(c);		/* XXX: may be used before set */
     43 }
     44 
     45 void
     46 set_complex_only_imag(double im)
     47 {
     48 	double _Complex c;
     49 
     50 	/* __real__ c is left uninitialized */
     51 	__imag__ c = im; /* FIXME *//* expect: may be used before set */
     52 	sink(c);		/* XXX: may be used before set */
     53 }
     54