1 Description: random pre-main initialization: prioritize
2 Clarify C++ pre-main initialization with the help of the gcc specific
3 attribute init_priority; closes RC bug #759696.
5 Author: Jerome Benoit <calculus@rezozer.net>
6 Last-Update: 2015-11-23
14 -extern const Point INVALID_POINT(INVALID_REAL, INVALID_REAL, INVALID_REAL);
15 -extern const Point ORIGIN(0, 0, 0);
16 -extern const Point_Pair INVALID_POINT_PAIR(INVALID_POINT, INVALID_POINT);
17 +extern const Point __attribute__((init_priority(500))) INVALID_POINT(INVALID_REAL, INVALID_REAL, INVALID_REAL);
18 +extern const Point __attribute__((init_priority(500))) ORIGIN(0, 0, 0);
19 +extern const Point_Pair __attribute__((init_priority(1000))) INVALID_POINT_PAIR(INVALID_POINT, INVALID_POINT);
21 -extern const Bool_Point INVALID_BOOL_POINT(false, INVALID_POINT);
22 -extern const Bool_Point_Pair INVALID_BOOL_POINT_PAIR(INVALID_BOOL_POINT,
23 - INVALID_BOOL_POINT);
24 +extern const Bool_Point __attribute__((init_priority(1000))) INVALID_BOOL_POINT(false, INVALID_POINT);
25 +extern const Bool_Point_Pair __attribute__((init_priority(2000))) INVALID_BOOL_POINT_PAIR(INVALID_BOOL_POINT, INVALID_BOOL_POINT);
28 -extern const Bool_Real_Point INVALID_BOOL_REAL_POINT(false, INVALID_REAL,
30 -extern const Bool_Point_Quadruple
31 +extern const Bool_Real_Point __attribute__((init_priority(1000))) INVALID_BOOL_REAL_POINT(false, INVALID_REAL, INVALID_POINT);
32 +extern const Bool_Point_Quadruple __attribute__((init_priority(2000)))
33 INVALID_BOOL_POINT_QUADRUPLE(INVALID_BOOL_POINT,
39 @q * Global constants for Line.@>
40 @ Global constants for {\bf Line}.
41 @<|Line| global constants@>=
42 -extern const Line INVALID_LINE(INVALID_POINT, INVALID_POINT);
43 +extern const Line __attribute__((init_priority(1000))) INVALID_LINE(INVALID_POINT, INVALID_POINT);
46 @<Declarations for the header file@>=
50 @q * (1) Global constants for Plane.@>
51 @* Global constants for {\bf Plane}.
52 @<|Plane| global constants@>=
53 -extern const Plane INVALID_PLANE(INVALID_POINT,
55 +extern const Plane __attribute__((init_priority(1000))) INVALID_PLANE(INVALID_POINT, INVALID_POINT);
58 @<Declarations for the header file@>=
65 -extern const Complex INVALID_COMPLEX(INVALID_REAL, INVALID_REAL);
66 +extern const Complex __attribute__((init_priority(500))) INVALID_COMPLEX(INVALID_REAL, INVALID_REAL);
70 --- a/src/transfor.web
71 +++ b/src/transfor.web
73 @q * Global constants. @>
76 -extern const Transform INVALID_TRANSFORM(INVALID_REAL);
77 +extern const Transform __attribute__((init_priority(500))) INVALID_TRANSFORM(INVALID_REAL);
78 extern const Transform IDENTITY_TRANSFORM;