r3281: some compilers can't handle empty structures, so for empty IDL
authorAndrew Tridgell <tridge@samba.org>
Wed, 27 Oct 2004 04:33:36 +0000 (04:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:04:49 +0000 (13:04 -0500)
structures generate a single _empty_ element in the header
(This used to be commit 00ff1ca1d284bb698e98c773b18a29695e927605)

source4/build/pidl/header.pm

index 848ceab9b06db3530ce4af3e59c57a70273f50f2..56f3503e5d4eda351085fa0b66834b4749594d18 100644 (file)
@@ -75,11 +75,17 @@ sub HeaderStruct($$)
     my($name) = shift;
     $res .= "\nstruct $name {\n";
     $tab_depth++;
+    my $el_count=0;
     if (defined $struct->{ELEMENTS}) {
        foreach my $e (@{$struct->{ELEMENTS}}) {
            HeaderElement($e);
+           $el_count++;
        }
     }
+    if ($el_count == 0) {
+           # some compilers can't handle empty structures
+           $res .= "\tchar _empty_;\n";
+    }
     $tab_depth--;
     $res .= "}";
 }