mirror of
https://github.com/verilator/verilator.git
synced 2026-10-07 10:33:13 +02:00
Internals: Use standard function for include guards. No functional change intended.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "V3File.h"
|
||||
#include "V3Os.h"
|
||||
#include "V3PreShell.h"
|
||||
#include "V3String.h"
|
||||
#include "V3Ast.h"
|
||||
|
||||
#include <cerrno>
|
||||
@@ -942,6 +943,17 @@ void V3OutFile::putsForceIncs() {
|
||||
}
|
||||
}
|
||||
|
||||
void V3OutCFile::putsGuard() {
|
||||
UASSERT(!m_guard, "Already called putsGuard in emit file");
|
||||
m_guard = true;
|
||||
string var = VString::upcase(string("_") + V3Os::filenameNonDir(filename()) + "_");
|
||||
for (string::iterator pos = var.begin(); pos != var.end(); ++pos) {
|
||||
if (!isalnum(*pos)) *pos = '_';
|
||||
}
|
||||
puts("\n#ifndef " + var + "\n");
|
||||
puts("#define " + var + " // guard\n");
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// VIdProtect
|
||||
|
||||
|
||||
Reference in New Issue
Block a user