From e93d828073efae353a599e4410e4953dc8ceacb7 Mon Sep 17 00:00:00 2001 From: Pauli Date: Sat, 7 Jul 2018 14:11:24 +0300 Subject: [PATCH] Include all dependecies in df headers This allows including df/*.h without including any dependecies first. It also helps ycm error reporting to avoid wrong errors when opening headers when it tries to compile header as c++ source file. --- Bitfield.pm | 2 ++ Common.pm | 3 +++ Enum.pm | 2 ++ StructFields.pm | 2 ++ codegen.pl | 1 + 5 files changed, 10 insertions(+) diff --git a/Bitfield.pm b/Bitfield.pm index 67edf38a0..2dfe43b62 100644 --- a/Bitfield.pm +++ b/Bitfield.pm @@ -94,6 +94,8 @@ sub render_bitfield_core { emit "static bitfield_identity identity;"; emit "static bitfield_identity *get() { return &identity; }"; } "template<> struct ${export_prefix}identity_$traits_name ", ";"; + header_ref("Export.h"); + header_ref("DataDefs.h"); }; with_emit_static { diff --git a/Common.pm b/Common.pm index f25adabb8..ae5464e9a 100644 --- a/Common.pm +++ b/Common.pm @@ -204,6 +204,9 @@ sub get_primitive_base($;$) { my ($tag, $default) = @_; my $base = $tag->getAttribute('base-type') || $default || 'uint32_t'; + if ($base =~ /u?int[136]?[2468]_t/) { + header_ref("cstdint"); + } $primitive_types{$base} or die "Must be primitive: $base\n"; return $base; diff --git a/Enum.pm b/Enum.pm index 8521e3cdd..a739d5a91 100644 --- a/Enum.pm +++ b/Enum.pm @@ -91,6 +91,8 @@ sub render_enum_tables($$$$$$) { emit "static enum_identity identity;"; emit "static enum_identity *get() { return &identity; }"; } "template<> struct ${export_prefix}identity_$traits_name ", ";"; + header_ref("Export.h"); + header_ref("DataDefs.h"); }; # Enumerate enum attributes diff --git a/StructFields.pm b/StructFields.pm index 623ad1921..82219fbc6 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -39,6 +39,8 @@ sub with_struct_block(&$;$%) { my $is_union = is_attr_true($tag,'is-union'); my $kwd = ($is_union ? "union" : "struct"); my $exp = $export_prefix; #$flags{-export} ? $export_prefix : ''; + header_ref("Export.h"); + header_ref("DataDefs.h"); my $prefix = $kwd.' '.$exp.($name ? $name.' ' : ''); emit_comment $tag, -attr => 1; diff --git a/codegen.pl b/codegen.pl index 13086ebfc..e8f4bd2ed 100755 --- a/codegen.pl +++ b/codegen.pl @@ -96,6 +96,7 @@ BEGIN my $prefix = get_container_item_type($tag, -weak => 1, -void => 'void'); emit_comment $tag; emit 'extern ', $export_prefix, $prefix, ' *', $name, ';', get_comment($tag); + header_ref("Export.h"); push @items, [ $prefix, $name ]; push @fields, $tag->findnodes('ld:item');