1 /* Producer string parsers for GDB.
3 Copyright (C) 2012-2017 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 producer_is_gcc_ge_4 (const char *producer)
30 if (! producer_is_gcc (producer, &major, &minor))
42 producer_is_gcc (const char *producer, int *major, int *minor)
46 if (producer != NULL && startswith (producer, "GNU "))
55 /* Skip any identifier after "GNU " - such as "C11" "C++" or "Java".
56 A full producer string might look like:
58 "GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..."
59 "GNU C++14 5.0.0 20150123 (experimental)"
61 cs = &producer[strlen ("GNU ")];
62 while (*cs && !isspace (*cs))
64 if (*cs && isspace (*cs))
66 if (sscanf (cs, "%d.%d", major, minor) == 2)
70 /* Not recognized as GCC. */