File: xsubppfix

package info (click to toggle)
libverilog-perl 3.482-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,728 kB
  • sloc: perl: 8,685; yacc: 3,387; cpp: 2,266; lex: 1,502; makefile: 8; fortran: 3
file content (20 lines) | stat: -rwxr-xr-x 747 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
#
# Copyright 2008-2024 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.
#
######################################################################

# DESCRIPTION: Edits xsubpp output to get around various issues.

foreach my $line (<STDIN>) {
    # Fix xsubpp 1.9508 and GCC 4.2.1 warning
    # "warning: deprecated conversion from string constant to ‘char*’"
    $line =~ s/^(\s*)(?:const\s*|)char\*\s*file\s*=\s*__FILE__;/${1}char* file = (char*)__FILE__;/;
    if ($line =~ /newXSproto/) {
	$line =~ s/([(,]\s*)"/$1(char*)"/g;
    }
    #
    print "$line";
}