LCOV - code coverage report
Current view: top level - libdw - dwarf_default_lower_bound.c (source / functions) Hit Total Coverage
Test: elfutils-0.173 Lines: 7 7 100.0 %
Date: 2018-06-29 23:49:12 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Get the default subrange lower bound for a given language.
       2             :    Copyright (C) 2016 Red Hat, Inc.
       3             :    This file is part of elfutils.
       4             : 
       5             :    This file is free software; you can redistribute it and/or modify
       6             :    it under the terms of either
       7             : 
       8             :      * the GNU Lesser General Public License as published by the Free
       9             :        Software Foundation; either version 3 of the License, or (at
      10             :        your option) any later version
      11             : 
      12             :    or
      13             : 
      14             :      * the GNU General Public License as published by the Free
      15             :        Software Foundation; either version 2 of the License, or (at
      16             :        your option) any later version
      17             : 
      18             :    or both in parallel, as here.
      19             : 
      20             :    elfutils is distributed in the hope that it will be useful, but
      21             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23             :    General Public License for more details.
      24             : 
      25             :    You should have received copies of the GNU General Public License and
      26             :    the GNU Lesser General Public License along with this program.  If
      27             :    not, see <http://www.gnu.org/licenses/>.  */
      28             : 
      29             : #ifdef HAVE_CONFIG_H
      30             : # include <config.h>
      31             : #endif
      32             : 
      33             : #include <dwarf.h>
      34             : #include "libdwP.h"
      35             : 
      36             : /* Determine default lower bound from language, as per the DWARF5
      37             :    "Subrange Type Entries" table.  */
      38             : int
      39          54 : dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
      40             : {
      41             :   switch (lang)
      42             :     {
      43             :     case DW_LANG_C:
      44             :     case DW_LANG_C89:
      45             :     case DW_LANG_C99:
      46             :     case DW_LANG_C11:
      47             :     case DW_LANG_C_plus_plus:
      48             :     case DW_LANG_C_plus_plus_03:
      49             :     case DW_LANG_C_plus_plus_11:
      50             :     case DW_LANG_C_plus_plus_14:
      51             :     case DW_LANG_ObjC:
      52             :     case DW_LANG_ObjC_plus_plus:
      53             :     case DW_LANG_Java:
      54             :     case DW_LANG_D:
      55             :     case DW_LANG_Python:
      56             :     case DW_LANG_UPC:
      57             :     case DW_LANG_OpenCL:
      58             :     case DW_LANG_Go:
      59             :     case DW_LANG_Haskell:
      60             :     case DW_LANG_OCaml:
      61             :     case DW_LANG_Rust:
      62             :     case DW_LANG_Swift:
      63             :     case DW_LANG_Dylan:
      64             :     case DW_LANG_RenderScript:
      65             :     case DW_LANG_BLISS:
      66          38 :       *result = 0;
      67          38 :       return 0;
      68             : 
      69             :     case DW_LANG_Ada83:
      70             :     case DW_LANG_Ada95:
      71             :     case DW_LANG_Cobol74:
      72             :     case DW_LANG_Cobol85:
      73             :     case DW_LANG_Fortran77:
      74             :     case DW_LANG_Fortran90:
      75             :     case DW_LANG_Fortran95:
      76             :     case DW_LANG_Fortran03:
      77             :     case DW_LANG_Fortran08:
      78             :     case DW_LANG_Pascal83:
      79             :     case DW_LANG_Modula2:
      80             :     case DW_LANG_Modula3:
      81             :     case DW_LANG_PLI:
      82             :     case DW_LANG_Julia:
      83          14 :       *result = 1;
      84          14 :       return 0;
      85             : 
      86             :     default:
      87           2 :       __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE);
      88           2 :       return -1;
      89             :     }
      90             : }
      91             : INTDEF (dwarf_default_lower_bound)

Generated by: LCOV version 1.13