]> gcc.gnu.org Git - gcc.git/blame - gcc/gccbug.in
arm.c (arm_override_options): Error on iWMMXt and hardware floating point.
[gcc.git] / gcc / gccbug.in
CommitLineData
e4476d1c
ML
1#!/bin/sh
2# Submit a problem report to a GNATS site.
6322fdd8 3# Copyright (C) 1993, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
e4476d1c
ML
4# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
5# version written by Heinz G. Seidl (hgs@cygnus.com).
6#
7# This file is part of GNU GNATS.
8#
9# GNU GNATS is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2, or (at your option)
12# any later version.
13#
14# GNU GNATS is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with GNU GNATS; see the file COPYING. If not, write to
366ccddb
KC
21# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22# Boston, MA 02110-1301, USA.
e4476d1c
ML
23
24# The version of this send-pr.
25VERSION=3.113
26
27# The submitter-id for your site.
28SUBMITTER=net
29
30# The default mail address for PR submissions.
31GNATS_ADDR=gcc-gnats@gcc.gnu.org
32
33# The default release for this host.
a1286ef5
ZW
34# We have to guess at what program_transform_name might have done.
35# "sed 1q" because neither "head -1" nor "head -n 1" is universal, argh.
36
37DEFAULT_GCC="`echo $0 | sed -e 's/bug//'`"
38DEFAULT_RELEASE="`$DEFAULT_GCC --version | sed 1q`"
e4476d1c
ML
39
40# The default organization.
41DEFAULT_ORGANIZATION=
42
43# What mailer to use. This must come after the config file, since it is
44# host-dependent.
45# Copied from cvsbug
46if [ -f /usr/sbin/sendmail ]; then
47 MAIL_AGENT="/usr/sbin/sendmail -oi -t"
48else
49 MAIL_AGENT="/usr/lib/sendmail -oi -t"
50fi
51MAILER=`echo $MAIL_AGENT | sed -e 's, .*,,'`
52if [ ! -f "$MAILER" ] ; then
53 echo "$COMMAND: Cannot file mail program \"$MAILER\"."
54 echo "$COMMAND: Please fix the MAIL_AGENT entry in the $COMMAND file."
55 exit 1
56fi
57
58
59# How to read the passwd database.
60PASSWD="cat /etc/passwd"
61
62ECHON=bsd
63
64if [ $ECHON = bsd ] ; then
65 ECHON1="echo -n"
66 ECHON2=
67elif [ $ECHON = sysv ] ; then
68 ECHON1=echo
69 ECHON2='\c'
70else
71 ECHON1=echo
72 ECHON2=
73fi
74
75#\f
76
77if [ -z "$TMPDIR" ]; then
78 TMPDIR=/tmp
79else
80 if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
81 TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
82 fi
83fi
84
955be633
JM
85if [ @have_mktemp_command@ = yes ]; then
86 TEMP0=`mktemp $TMPDIR/poXXXXXX` || exit 1
87 TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1
88 BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1
89 REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1
fa27606c 90 REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF"
955be633 91else
fa27606c
JM
92 TEMPD=$TMPDIR/pd$$
93 TEMP0=$TEMPD/po$$
94 TEMP=$TEMPD/p$$
95 BAD=$TEMPD/pbad$$
96 REF=$TEMPD/pf$$
97 mkdir $TEMPD || exit 1
98 REMOVE_TEMP="rm -rf $TEMPD"
955be633 99fi
e4476d1c
ML
100
101# find a user name
102if [ "$LOGNAME" = "" ]; then
103 if [ "$USER" != "" ]; then
104 LOGNAME="$USER"
105 else
106 LOGNAME="UNKNOWN"
107 fi
108fi
109
110FROM="$LOGNAME"
111REPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}"
112
113# Find out the name of the originator of this PR.
114if [ -n "$NAME" ]; then
115 ORIGINATOR="$NAME"
116elif [ -f $HOME/.fullname ]; then
117 ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
118else
119 # Must use temp file due to incompatibilities in quoting behavior
120 # and to protect shell metacharacters in the expansion of $LOGNAME
955be633
JM
121 $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP0
122 ORIGINATOR="`cat $TEMP0`"
123 rm -f $TEMP0
e4476d1c
ML
124fi
125
126if [ -n "$ORGANIZATION" ]; then
127 if [ -f "$ORGANIZATION" ]; then
128 ORGANIZATION="`cat $ORGANIZATION`"
129 fi
130else
131 if [ -n "$DEFAULT_ORGANIZATION" ]; then
132 ORGANIZATION="$DEFAULT_ORGANIZATION"
133 elif [ -f $HOME/.organization ]; then
134 ORGANIZATION="`cat $HOME/.organization`"
135 fi
136fi
137
138# If they don't have a preferred editor set, then use
139if [ -z "$VISUAL" ]; then
140 if [ -z "$EDITOR" ]; then
141 EDIT=vi
142 else
143 EDIT="$EDITOR"
144 fi
145else
146 EDIT="$VISUAL"
147fi
148
149# Find out some information.
150SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
151 ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
152ARCH=`[ -f /bin/arch ] && /bin/arch`
153MACHINE=`[ -f /bin/machine ] && /bin/machine`
154
155COMMAND=`echo $0 | sed -e 's,.*/,,'`
156USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity]
157 [-c address] [--request-id] [--version]"
158REMOVE=
159BATCH=
160CC=
161SEVERITY_C=
162
163while [ $# -gt 0 ]; do
164 case "$1" in
165 -r) ;; # Ignore for backward compat.
955be633 166 -t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
e4476d1c
ML
167 shift ; GNATS_ADDR="$1"
168 EXPLICIT_GNATS_ADDR=true
169 ;;
955be633 170 -f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
e4476d1c
ML
171 shift ; IN_FILE="$1"
172 if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
173 echo "$COMMAND: cannot read $IN_FILE"
955be633 174 $REMOVE_TEMP
e4476d1c
ML
175 exit 1
176 fi
177 ;;
178 -b | --batch) BATCH=true ;;
955be633 179 -c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
e4476d1c
ML
180 shift ; CC="$1"
181 ;;
955be633 182 -s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
e4476d1c
ML
183 shift ; SEVERITY_C="$1"
184 ;;
185 -p | -P | --print) PRINT=true ;;
186 -L | --list) FORMAT=norm ;;
187 -l | -CL | --lisp) FORMAT=lisp ;;
188 --request-id) REQUEST_ID=true ;;
955be633 189 -h | --help) echo "$USAGE"; $REMOVE_TEMP; exit 0 ;;
8512bbd7
JM
190 -V | --version) cat <<EOF
191gccbug (GCC) $DEFAULT_RELEASE
192Copyright (C) 2002 Free Software Foundation, Inc.
193This is free software; see the source for copying conditions. There is NO
194warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
195
196EOF
197 $REMOVE_TEMP; exit 0 ;;
955be633
JM
198 -*) echo "$USAGE" ; $REMOVE_TEMP; exit 1 ;;
199 *) echo "$USAGE" ; $REMOVE_TEMP; exit 1
e4476d1c
ML
200 esac
201 shift
202done
203
204# spam does not need to be listed here
3e4035f8 205CATEGORIES="ada bootstrap c++ c debug driver fortran inline-asm java libgcj libobjc libstdc++ middle-end objc other pch preprocessor rtl-optimization target tree-optimization web"
e4476d1c
ML
206
207case "$FORMAT" in
208 lisp) echo "$CATEGORIES" | \
209 awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}'
955be633 210 $REMOVE_TEMP
e4476d1c
ML
211 exit 0
212 ;;
213 norm) l=`echo "$CATEGORIES" | \
214 awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
215 END {print max + 1;}'`
216 c=`expr 70 / $l`
217 if [ $c -eq 0 ]; then c=1; fi
218 echo "$CATEGORIES" | \
219 awk 'BEGIN {print "Known categories:"; i = 0 }
220 { printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } }
221 END { print ""; }'
955be633 222 $REMOVE_TEMP
e4476d1c
ML
223 exit 0
224 ;;
225esac
226
227ORIGINATOR_C='<name of the PR author (one line)>'
228ORGANIZATION_C='<organization of PR author (multiple lines)>'
e4476d1c
ML
229SYNOPSIS_C='<synopsis of the problem (one line)>'
230if [ -z "$SEVERITY_C" ]; then
231 SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
232fi
cf440c3c 233PRIORITY_C='<[ low | medium ] (one line)>'
501a4819 234CATEGORY_C='<choose from the top of this file (one line)>'
e4476d1c
ML
235RELEASE_C='<release number or tag (one line)>'
236ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
237DESCRIPTION_C='<precise description of the problem (multiple lines)>'
d5fb67d3 238HOW_TO_REPEAT_C='<When reporting a compiler error, preprocessor output must be included>'
e4476d1c
ML
239FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
240
241# Catch some signals. ($xs kludge needed by Sun /bin/sh)
242xs=0
955be633
JM
243trap '$REMOVE_TEMP; exit $xs' 0
244trap 'echo "$COMMAND: Aborting ..."; $REMOVE_TEMP; xs=1; exit' 1 3 13 15
e4476d1c
ML
245
246# If they told us to use a specific file, then do so.
247if [ -n "$IN_FILE" ]; then
248 if [ "$IN_FILE" = "-" ]; then
249 # The PR is coming from the standard input.
250 if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
251 sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP
252 else
253 cat > $TEMP
254 fi
255 else
256 # Use the file they named.
257 if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
258 sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP
259 else
260 cat $IN_FILE > $TEMP
261 fi
262 fi
263else
264
265 if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
266 # If their PR_FORM points to a bogus entry, then bail.
267 if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then
268 echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM"
269 sleep 1
270 PRINT_INTERN=bad_prform
271 fi
272 fi
273
274 if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
275 cp $PR_FORM $TEMP ||
276 ( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit )
277 else
278 for file in $TEMP $REF ; do
279 cat > $file << '__EOF__'
280SEND-PR: -*- send-pr -*-
281SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
282SEND-PR: will all comments (text enclosed in `<' and `>').
283SEND-PR:
e98df22a 284SEND-PR: Please consult the GCC manual if you are not sure how to
501a4819 285SEND-PR: fill out a problem report.
e4476d1c
ML
286SEND-PR: Note that the Synopsis field is mandatory. The Subject (for
287SEND-PR: the mail) will be made the same as Synopsis unless explicitly
288SEND-PR: changed.
289SEND-PR:
290SEND-PR: Choose from the following categories:
291SEND-PR:
292__EOF__
293
294 # Format the categories so they fit onto lines.
295 l=`echo "$CATEGORIES" | \
296 awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
297 END {print max + 1;}'`
298 c=`expr 61 / $l`
299 if [ $c -eq 0 ]; then c=1; fi
300 echo "$CATEGORIES" | \
301 awk 'BEGIN {printf "SEND-PR: "; i = 0 }
302 { printf ("%-'$l'.'$l's", $0);
303 if ((++i % '$c') == 0) { printf "\nSEND-PR: " } }
304 END { printf "\nSEND-PR:\n"; }' >> $file
305
306 cat >> $file << __EOF__
307To: $GNATS_ADDR
308Subject:
309From: $FROM
310Reply-To: $REPLYTO
311Cc: $CC
312X-send-pr-version: $VERSION
313X-GNATS-Notify:
314
315
316>Submitter-Id: $SUBMITTER
317>Originator: $ORIGINATOR
318>Organization: ${ORGANIZATION-$ORGANIZATION_C}
8763704d
JM
319>Confidential: no
320SEND-PR: Leave "Confidential" as "no"; all GCC PRs are public.
e4476d1c
ML
321>Synopsis: $SYNOPSIS_C
322>Severity: $SEVERITY_C
501a4819
ML
323SEND-PR: critical GCC is completely not operational; no work-around known.
324SEND-PR: serious GCC is not working properly; a work-around is possible.
325SEND-PR: non-critical Report indicates minor problem.
e4476d1c 326>Priority: $PRIORITY_C
501a4819
ML
327SEND-PR: medium The problem should be solved in the next release.
328SEND-PR: low The problem should be solve in a future release.
e4476d1c 329>Category: $CATEGORY_C
501a4819 330>Class: <[ doc-bug | accepts-illegal | rejects-legal | wrong-code | ice-on-legal-code| ice-on-illegal-code | pessimizes-code | sw-bug | change-request | support ] (one line)>
b0317102 331SEND-PR: doc-bug The documentation is incorrect.
501a4819
ML
332SEND-PR: accepts-illegal GCC fails to reject erroneous code.
333SEND-PR: rejects-legal GCC gives an error message for correct code.
334SEND-PR: wrong-code The machine code generated by gcc is incorrect.
335SEND-PR: ice-on-legal-code GCC gives an Internal Compiler Error (ICE)
336SEND-PR: for correct code
337SEND-PR: ice-on-illegal-code GCC gives an ICE instead of reporting an error
338SEND-PR: pessimizes-code GCC misses an important optimization opportunity
339SEND-PR: sw-bug Software bug of some other class than above
340SEND-PR: change-request A feature in GCC is missing.
341SEND-PR: support I need help with gcc.
e4476d1c
ML
342>Release: ${DEFAULT_RELEASE-$RELEASE_C}
343>Environment:
344`[ -n "$SYSTEM" ] && echo System: $SYSTEM`
345`[ -n "$ARCH" ] && echo Architecture: $ARCH`
346`[ -n "$MACHINE" ] && echo Machine: $MACHINE`
347 $ENVIRONMENT_C
348host: @host@
349build: @build@
350target: @target@
eeae7b41
DJ
351__EOF__
352 cat >> $file << \__EOF__
cc1e60ea 353configured with: @gcc_config_arguments@
eeae7b41
DJ
354__EOF__
355 cat >> $file << __EOF__
e4476d1c
ML
356>Description:
357 $DESCRIPTION_C
358>How-To-Repeat:
359 $HOW_TO_REPEAT_C
360>Fix:
361 $FIX_C
362__EOF__
363 done
364 fi
365
366 if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
367 cat $TEMP
368 xs=0; exit
369 fi
370
371 chmod u+w $TEMP
372 if [ -z "$REQUEST_ID" ]; then
373 eval $EDIT $TEMP
374 else
375 ed -s $TEMP << '__EOF__'
376/^Subject/s/^Subject:.*/Subject: request for a customer id/
377/^>Category/s/^>Category:.*/>Category: send-pr/
378w
379q
380__EOF__
381 fi
382
383 if cmp -s $REF $TEMP ; then
384 echo "$COMMAND: problem report not filled out, therefore not sent"
385 xs=1; exit
386 fi
387fi
388
389#\f
390# Check the enumeration fields
391
392# This is a "sed-subroutine" with one keyword parameter
393# (with workaround for Sun sed bug)
394#
395SED_CMD='
396/$PATTERN/{
397s|||
398s|<.*>||
399s|^[ ]*||
400s|[ ]*$||
401p
402q
403}'
404
405
406while [ -z "$REQUEST_ID" ]; do
407 CNT=0
408
409 # 1) Confidential
410 #
411 PATTERN=">Confidential:"
412 CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
413 case "$CONFIDENTIAL" in
8763704d 414 no) CNT=`expr $CNT + 1` ;;
e4476d1c
ML
415 *) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
416 esac
417 #
418 # 2) Severity
419 #
420 PATTERN=">Severity:"
421 SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
422 case "$SEVERITY" in
423 ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
424 *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
425 esac
426 #
427 # 3) Priority
428 #
429 PATTERN=">Priority:"
430 PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
431 case "$PRIORITY" in
cf440c3c
PE
432 ""|low|medium) CNT=`expr $CNT + 1` ;;
433 high) echo "$COMMAND: \`Priority: high' is reserved for GCC maintainers." ;;
e4476d1c
ML
434 *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
435 esac
436 #
437 # 4) Category
438 #
439 PATTERN=">Category:"
440 CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
441 FOUND=
442 for C in $CATEGORIES
443 do
444 if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi
445 done
446 if [ -n "$FOUND" ]; then
447 CNT=`expr $CNT + 1`
448 else
449 if [ -z "$CATEGORY" ]; then
450 echo "$COMMAND: you must include a Category: field in your report."
451 else
452 echo "$COMMAND: \`$CATEGORY' is not a known category."
453 fi
454 fi
455 #
456 # 5) Class
457 #
458 PATTERN=">Class:"
459 CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
460 case "$CLASS" in
501a4819 461 ""|doc-bug|accepts-illegal|rejects-legal|wrong-code|ice-on-legal-code|ice-on-illegal-code|pessimizes-code|sw-bug|change-request|support) CNT=`expr $CNT + 1` ;;
e4476d1c
ML
462 *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
463 esac
464 #
465 # 6) Check that synopsis is not empty
466 #
467 if grep "^>Synopsis:[ ]*${SYNOPSIS_C}\$" $TEMP > /dev/null
468 then
469 echo "$COMMAND: Synopsis must not be empty."
470 else
471 CNT=`expr $CNT + 1`
472 fi
473
474 [ $CNT -lt 6 -a -z "$BATCH" ] &&
475 echo "Errors were found with the problem report."
476
477 while true; do
478 if [ -z "$BATCH" ]; then
479 $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
480 read input
481 else
482 if [ $CNT -eq 6 ]; then
483 input=s
484 else
485 input=a
486 fi
487 fi
488 case "$input" in
489 a*)
490 if [ -z "$BATCH" ]; then
491 echo "$COMMAND: the problem report remains in $BAD and is not sent."
955be633 492 REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
e4476d1c
ML
493 mv $TEMP $BAD
494 else
495 echo "$COMMAND: the problem report is not sent."
496 fi
497 xs=1; exit
498 ;;
499 e*)
500 eval $EDIT $TEMP
501 continue 2
502 ;;
503 s*)
504 break 2
505 ;;
506 esac
507 done
508done
509
510#
511# Make sure the mail has got a Subject. If not, use the same as
512# in Synopsis.
513#
514
515if grep '^Subject:[ ]*$' $TEMP > /dev/null
516then
517 SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ ]*//'`
518 ed -s $TEMP << __EOF__
519/^Subject:/s/:.*\$/: $SYNOPSIS/
520w
521q
522__EOF__
523fi
524
525#
526# Remove comments and send the problem report
527# (we have to use patterns, where the comment contains regex chars)
528#
529# /^>Originator:/s;$ORIGINATOR;;
530sed -e "
531/^SEND-PR:/d
532/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
533/^>Confidential:/s;<.*>;;
534/^>Synopsis:/s;$SYNOPSIS_C;;
535/^>Severity:/s;<.*>;;
536/^>Priority:/s;<.*>;;
537/^>Category:/s;$CATEGORY_C;;
538/^>Class:/s;<.*>;;
539/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
540/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
541/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
542/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
543/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
544" $TEMP > $REF
545
546if $MAIL_AGENT < $REF; then
547 echo "$COMMAND: problem report sent"
548 xs=0; exit
549else
550 echo "$COMMAND: mysterious mail failure."
551 if [ -z "$BATCH" ]; then
552 echo "$COMMAND: the problem report remains in $BAD and is not sent."
955be633 553 REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
e4476d1c
ML
554 mv $REF $BAD
555 else
556 echo "$COMMAND: the problem report is not sent."
557 fi
558 xs=1; exit
559fi
This page took 1.611682 seconds and 5 git commands to generate.