From 62866dc8be31fa879594379546ad7f42758f4abb Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 24 Jan 2010 19:00:34 -0500 Subject: [PATCH] Repair includes that should be C++ instead of C flavor --- src/V3File.cpp | 2 +- src/Verilator.cpp | 2 +- test_regress/t/t_dist_cinclude.pl | 54 ++++++++++++++++++++++++++++++ test_regress/t/t_dpi_context_c.cpp | 2 +- test_regress/t/t_dpi_display_c.cpp | 2 +- test_regress/t/t_dpi_export_c.cpp | 2 +- test_regress/t/t_dpi_import_c.cpp | 4 +-- test_regress/t/t_dpi_sys_c.cpp | 2 +- 8 files changed, 62 insertions(+), 8 deletions(-) create mode 100755 test_regress/t/t_dist_cinclude.pl diff --git a/src/V3File.cpp b/src/V3File.cpp index 9da26d5c7..32904701c 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 4706f2182..f6aca4110 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -21,7 +21,7 @@ #include "V3Global.h" #include "V3Ast.h" -#include +#include #include #include "V3Active.h" diff --git a/test_regress/t/t_dist_cinclude.pl b/test_regress/t/t_dist_cinclude.pl new file mode 100755 index 000000000..be66359d8 --- /dev/null +++ b/test_regress/t/t_dist_cinclude.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +use IO::File; + +my $root = ".."; +my $Debug; + +if (!-r "$root/.git") { + $Self->skip("Not in a git repository"); +} else { + ### Must trim output before and after our file list + my $files = `cd $root && git ls-files --exclude-standard`; + print "ST $files\n" if $Debug; + $files =~ s/\s+/ /g; + my $cmd = "cd $root && fgrep -n include $files | sort"; + my $grep = `$cmd`; + foreach my $line (split /\n/, $grep) { + my $hit; + $hit = 1 if $line =~ /\bassert\.h/; + $hit = 1 if $line =~ /\bctype\.h/; + $hit = 1 if $line =~ /\berrno\.h/; + $hit = 1 if $line =~ /\bfloat\.h/; + $hit = 1 if $line =~ /\blimits\.h/; + $hit = 1 if $line =~ /\blocale\.h/; + $hit = 1 if $line =~ /\bmath\.h/; + $hit = 1 if $line =~ /\bsetjmp\.h/; + $hit = 1 if $line =~ /\bsignal\.h/; + $hit = 1 if $line =~ /\bstdarg\.h/; + $hit = 1 if $line =~ /\bstdbool\.h/; + $hit = 1 if $line =~ /\bstddef\.h/; + #Not yet: $hit = 1 if $line =~ /\bstdint\.h/; + $hit = 1 if $line =~ /\bstdio\.h/; + $hit = 1 if $line =~ /\bstdlib\.h/; + $hit = 1 if $line =~ /\bstring\.h/; + $hit = 1 if $line =~ /\btime\.h/; + next if !$hit; + print "$line\n"; + $names{$1} = 1 if $line =~ /^([^:]+)/; + } + + if (keys %names) { + $Self->error("Files like stdint.h instead of cstdint: ",join(' ',sort keys %names)); + } +} + +ok(1); +1; diff --git a/test_regress/t/t_dpi_context_c.cpp b/test_regress/t/t_dpi_context_c.cpp index 8f5516405..075c77ffd 100644 --- a/test_regress/t/t_dpi_context_c.cpp +++ b/test_regress/t/t_dpi_context_c.cpp @@ -13,7 +13,7 @@ // //************************************************************************* -#include +#include #include //====================================================================== diff --git a/test_regress/t/t_dpi_display_c.cpp b/test_regress/t/t_dpi_display_c.cpp index 8acb8d45f..914782add 100644 --- a/test_regress/t/t_dpi_display_c.cpp +++ b/test_regress/t/t_dpi_display_c.cpp @@ -13,7 +13,7 @@ // //************************************************************************* -#include +#include #include //====================================================================== diff --git a/test_regress/t/t_dpi_export_c.cpp b/test_regress/t/t_dpi_export_c.cpp index 4349b6d69..826d90f0e 100644 --- a/test_regress/t/t_dpi_export_c.cpp +++ b/test_regress/t/t_dpi_export_c.cpp @@ -13,7 +13,7 @@ // //************************************************************************* -#include +#include #include #include diff --git a/test_regress/t/t_dpi_import_c.cpp b/test_regress/t/t_dpi_import_c.cpp index 1d04b12a7..053ab3f40 100644 --- a/test_regress/t/t_dpi_import_c.cpp +++ b/test_regress/t/t_dpi_import_c.cpp @@ -13,9 +13,9 @@ // //************************************************************************* -#include -#include +#include #include +#include //====================================================================== diff --git a/test_regress/t/t_dpi_sys_c.cpp b/test_regress/t/t_dpi_sys_c.cpp index b6811c0ab..da380e7eb 100644 --- a/test_regress/t/t_dpi_sys_c.cpp +++ b/test_regress/t/t_dpi_sys_c.cpp @@ -13,7 +13,7 @@ // //************************************************************************* -#include +#include #include //======================================================================