| 1 | 690 | jeremybenn | # Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
 | 
      
         | 2 |  |  |  
 | 
      
         | 3 |  |  | # This program is free software; you can redistribute it and/or modify
 | 
      
         | 4 |  |  | # it under the terms of the GNU General Public License as published by
 | 
      
         | 5 |  |  | # the Free Software Foundation; either version 3 of the License, or
 | 
      
         | 6 |  |  | # (at your option) any later version.
 | 
      
         | 7 |  |  | #
 | 
      
         | 8 |  |  | # This program is distributed in the hope that it will be useful,
 | 
      
         | 9 |  |  | # but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
      
         | 10 |  |  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
      
         | 11 |  |  | # GNU General Public License for more details.
 | 
      
         | 12 |  |  | #
 | 
      
         | 13 |  |  | # You should have received a copy of the GNU General Public License
 | 
      
         | 14 |  |  | # along with GCC; see the file COPYING3.  If not see
 | 
      
         | 15 |  |  | # .
 | 
      
         | 16 |  |  |  
 | 
      
         | 17 |  |  | # This file contains a set of test that check that gcc options are
 | 
      
         | 18 |  |  | # documented in --help, and that the various --help* options work.
 | 
      
         | 19 |  |  |  
 | 
      
         | 20 |  |  | load_lib options.exp
 | 
      
         | 21 |  |  |  
 | 
      
         | 22 |  |  | # Document --version.  Ideally, there should be no undocumented switches
 | 
      
         | 23 |  |  | # in --help.
 | 
      
         | 24 |  |  | check_for_options c "--help" "--version" "This switch lacks documentation" ""
 | 
      
         | 25 |  |  |  
 | 
      
         | 26 |  |  | # Output from different subprocesses should not be intermingled
 | 
      
         | 27 |  |  | # (we check for some patterns that could be seen with a missing
 | 
      
         | 28 |  |  | # fflush in gcc.c).
 | 
      
         | 29 |  |  | check_for_options c "-v --help" "" {
 | 
      
         | 30 |  |  | [^\n]The following options
 | 
      
         | 31 |  |  | -Wconversion[^\n]*lacks documentation
 | 
      
         | 32 |  |  | "  -g  "
 | 
      
         | 33 |  |  | } ""
 | 
      
         | 34 |  |  |  
 | 
      
         | 35 |  |  | # There are still undocumented switches in -v --help.
 | 
      
         | 36 |  |  | check_for_options c "-v --help" "" "This switch lacks documentation" "xfail"
 | 
      
         | 37 |  |  |  
 | 
      
         | 38 |  |  | # Check whether multiline conversion in optc-gen is broken.
 | 
      
         | 39 |  |  | check_for_options c "-v --help" "" {are likely to\n  -std} ""
 | 
      
         | 40 |  |  |  
 | 
      
         | 41 |  |  | # Try various --help= classes and qualifiers.
 | 
      
         | 42 |  |  | check_for_options c "--help=optimizers" "-O" "  -g  " ""
 | 
      
         | 43 |  |  | check_for_options c "--help=params" "maximum number of" "-Wunsafe-loop-optimizations" ""
 | 
      
         | 44 |  |  | check_for_options c "--help=C" "-ansi" "-gnatO" ""
 | 
      
         | 45 |  |  | check_for_options c {--help=C++} {-std=c\+\+} "-gnatO" ""
 | 
      
         | 46 |  |  | check_for_options c "--help=common" "-dumpbase" "-gnatO" ""
 | 
      
         | 47 |  |  | check_for_options c "--help=undocumented" "This switch lacks documentation" "" ""
 | 
      
         | 48 |  |  |  
 | 
      
         | 49 |  |  | # Undocumented flags are not yet consistently marked as such.
 | 
      
         | 50 |  |  | check_for_options c "--help=^undocumented" "-Wall" "This switch lacks documentation" "xfail"
 | 
      
         | 51 |  |  |  
 | 
      
         | 52 |  |  | # Try some --help=* examples from the manual.
 | 
      
         | 53 |  |  | check_for_options c "--help=target,undocumented" "" "" ""
 | 
      
         | 54 |  |  | check_for_options c "--help=target,optimizers" "" "" ""
 | 
      
         | 55 |  |  | check_for_options c "--help=warnings,^joined,^undocumented" "" "" ""
 | 
      
         | 56 |  |  | check_for_options c "-Q -O2 --help=optimizers" {
 | 
      
         | 57 |  |  | -O
 | 
      
         | 58 |  |  | -ftree-vectorize[^\n]*disabled
 | 
      
         | 59 |  |  | } "  -g  " ""
 | 
      
         | 60 |  |  | check_for_options c "-Q -O3 --help=optimizers" {
 | 
      
         | 61 |  |  | -O
 | 
      
         | 62 |  |  | -ftree-vectorize[^\n]*enabled
 | 
      
         | 63 |  |  | } "  -g  " ""
 | 
      
         | 64 |  |  | # Try repeated --help=.
 | 
      
         | 65 |  |  | check_for_options c "--help=params --help=optimizers" {
 | 
      
         | 66 |  |  | maximum number of
 | 
      
         | 67 |  |  | -O
 | 
      
         | 68 |  |  | } "" ""
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  | # Ensure PR 37805 is fixed.
 | 
      
         | 71 |  |  | check_for_options c "--help=joined" "Wformat=" "-fstrict-prototype" ""
 | 
      
         | 72 |  |  | check_for_options c "--help=separate" "-MF" "-fstrict-prototype" ""
 | 
      
         | 73 |  |  | check_for_options c "--help=warnings,joined" "Wformat=" "Wtrigraphs" ""
 | 
      
         | 74 |  |  | check_for_options c "--help=warnings,^joined" "Wtrigraphs" "Wformat=" ""
 | 
      
         | 75 |  |  | check_for_options c "--help=joined,separate" "-I" "" ""
 | 
      
         | 76 |  |  | check_for_options c "--help=^joined,separate" "--param " "" ""
 | 
      
         | 77 |  |  | check_for_options c "--help=joined,^separate" "--help=" "" ""
 | 
      
         | 78 |  |  | check_for_options c "--help=joined,undocumented" "" "" ""
 | 
      
         | 79 |  |  | # Listing only excludes gives empty results.
 | 
      
         | 80 |  |  | check_for_options c "--help=^joined,^separate" "" "" ""
 |