* config/stormy16/stormy16.c (xstormy16_asm_output_aligned_common):
[official-gcc.git] / gcc / opt-functions.awk
bloba21f29d4b1248f55141e8e951413a59d3ac44707
1 # Copyright (C) 2003,2004 Free Software Foundation, Inc.
2 # Contributed by Kelley Cook, June 2004.
3 # Original code from Neil Booth, May 2003.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Some common subroutines for use by opt[ch]-gen.awk.
21 function switch_flags (flags)
23 flags = " " flags " "
24 result = "0"
25 for (j = 0; j < n_langs; j++) {
26 regex = " " langs[j] " "
27 gsub ( "\\+", "\\+", regex )
28 if (flags ~ regex)
29 result = result " | " macros[j]
31 if (flags ~ " Common ") result = result " | CL_COMMON"
32 if (flags ~ " Joined ") result = result " | CL_JOINED"
33 if (flags ~ " JoinedOrMissing ") \
34 result = result " | CL_JOINED | CL_MISSING_OK"
35 if (flags ~ " Separate ") result = result " | CL_SEPARATE"
36 if (flags ~ " RejectNegative ") result = result " | CL_REJECT_NEGATIVE"
37 if (flags ~ " UInteger ") result = result " | CL_UINTEGER"
38 if (flags ~ " Undocumented ") result = result " | CL_UNDOCUMENTED"
39 if (flags ~ " Report ") result = result " | CL_REPORT"
40 sub( "^0 \\| ", "", result )
41 return result
44 function var_args(flags)
46 if (flags !~ "Var\\(")
47 return ""
48 sub(".*Var\\(", "", flags)
49 sub("\\).*", "", flags)
51 return flags
53 function var_name(flags)
55 s = var_args(flags)
56 if (s == "")
57 return "";
58 sub( ",.*", "", s)
59 return s
61 function var_set(flags)
63 s = var_args(flags)
64 if (s !~ ",")
65 return "0, 0"
66 sub( "[^,]*,", "", s)
67 return "1, " s
69 function var_ref(flags)
71 name = var_name(flags)
72 if (name == "")
73 return "0"
74 else
75 return "&" name