Blob Blame History Raw
From 8b58e81cb74b9f30522fa7b33e5f642f368b1e58 Mon Sep 17 00:00:00 2001
From: Petr Machata <pmachata@gmail.com>
Date: Fri, 22 Dec 2017 01:13:19 +0100
Subject: [PATCH] libzwerg: builtin-dw-voc: known-dwarf.h misses DW_MACRO_GNU_*

known-dwarf.h, both as we build it, and as elfutils ships it, misses the
definitions of DW_MACRO_GNU_* enumerators, because as of elfutils 0.170
they are not enums anymore. Since the old enum is now kept in
backward-compatibility mode, it's likely it won't be added to, and it's
safe to expand it in situ in dwgrep.

Signed-off-by: Petr Machata <pmachata@gmail.com>
---
 libzwerg/builtin-dw-voc.cc       |  2 ++
 libzwerg/dwcst.cc                |  5 ++++-
 libzwerg/known-dwarf-macro-gnu.h | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 libzwerg/known-dwarf-macro-gnu.h

diff --git a/libzwerg/builtin-dw-voc.cc b/libzwerg/builtin-dw-voc.cc
index b49b95e..495262a 100644
--- a/libzwerg/builtin-dw-voc.cc
+++ b/libzwerg/builtin-dw-voc.cc
@@ -1,4 +1,5 @@
 /*
+   Copyright (C) 2017 Petr Machata
    Copyright (C) 2015 Red Hat, Inc.
    This file is part of dwgrep.
 
@@ -33,6 +34,7 @@
 #include "builtin-symbol.hh"
 #include "dwcst.hh"
 #include "known-dwarf.h"
+#include "known-dwarf-macro-gnu.h"
 #include "known-elf.h"
 
 std::unique_ptr <vocabulary>
diff --git a/libzwerg/dwcst.cc b/libzwerg/dwcst.cc
index 0831def..6a5bbf3 100644
--- a/libzwerg/dwcst.cc
+++ b/libzwerg/dwcst.cc
@@ -1,4 +1,6 @@
-/* Parts of this file were adapted from eu-readelf.
+/*
+   Copyright (C) 2017 Petr Machata
+   Parts of this file were adapted from eu-readelf.
    Copyright (C) 1999-2015 Red Hat, Inc.
 
    This file is free software; you can redistribute it and/or modify
@@ -20,6 +22,7 @@
 #include <climits>
 
 #include "known-dwarf.h"
+#include "known-dwarf-macro-gnu.h"
 #include "constant.hh"
 #include "flag_saver.hh"
 
diff --git a/libzwerg/known-dwarf-macro-gnu.h b/libzwerg/known-dwarf-macro-gnu.h
new file mode 100644
index 0000000..d43797f
--- /dev/null
+++ b/libzwerg/known-dwarf-macro-gnu.h
@@ -0,0 +1,39 @@
+/*
+   Copyright (C) 2017 Petr Machata
+   This file is part of dwgrep.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   dwgrep is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef DWARF_ALL_KNOWN_DW_MACRO_GNU
+# define DWARF_ALL_KNOWN_DW_MACRO_GNU \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (define, DW_MACRO_GNU_define) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (define_indirect, DW_MACRO_GNU_define_indirect) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (end_file, DW_MACRO_GNU_end_file) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (start_file, DW_MACRO_GNU_start_file) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (transparent_include, DW_MACRO_GNU_transparent_include) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (undef, DW_MACRO_GNU_undef) \
+  DWARF_ONE_KNOWN_DW_MACRO_GNU (undef_indirect, DW_MACRO_GNU_undef_indirect) \
+  /* End of DW_MACRO_GNU_*.  */
+#endif
-- 
2.13.6