Parma Polyhedra Library requirements
C++ command-line output pathname support

C++ command-line output pathname support

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
SW_SPEC
1
PPL-SPEC-001657
PPL-SPEC-001657
Native output pathname construction for polyhedral conversion

In the threaded PPL backend of ppl_lcdd, build_output_name shall accept a non-null null-terminated input pathname and an optional null-terminated output-directory pathname. It shall return the native input basename followed by .out, joined to the supplied nonempty directory or to . when that directory is null or empty. An empty basename shall yield .out. Native path separators and basename rules shall apply; in particular, a backslash in a POSIX basename shall be preserved. The inputs shall remain unchanged. The function shall not access the filesystem. Allocation and native pathname-conversion failures may propagate.

Preserving characters inside a native basename avoids conflating distinct basenames when routing threaded conversion output into a directory.

APPROVED
COMMAND_LINE_TOOLS
IF_CPP, THREAD_SAFE_BUILD
Test, Analysis, Inspection

Compare native basename and join semantics for null, empty and explicit directories, trailing separators, empty and long basenames and literal backslashes. Through the actual command line, convert distinct POSIX input names that previously collided and compare both result files with a known conversion, in default and explicit output directories.

demos/ppl_lcdd/ppl_lcdd.cc; demos/ppl_lcdd/outputnamespec1.cc; demos/ppl_lcdd/check_named_output.sh.

CPP
Internal

Internal function in demos/ppl_lcdd/ppl_lcdd.cc:

std::string build_output_name(const char* path_out, const char* name_in);
SW_SPEC
2
PPL-SPEC-001735
PPL-SPEC-001735
Conversion worker queue and shutdown protocol

Threadsafe_Queue shall serialize access to its FIFO. A successful try_pop shall assign and remove the oldest queued item; an empty queue shall return false without assigning an item. empty is a synchronized observation rather than a reservation. These operations require the element type's used copy/move operations to complete successfully when a completed queue action is required.

The pool shall select at least one worker. If starting a worker fails, the constructor shall stop and join every worker it has started before propagating the exception.

For a successfully constructed pool, submissions made before finalize or destruction shall be queued. Workers shall repeatedly claim and invoke queued work. finalize shall request stopping once the queue is drained; destruction shall request that stop and join every worker before returning. Work submitted before stopping shall be invoked once when work and queue operations complete normally. No submission may race with or follow the stop request. Work must not allow an exception to escape its worker entry point. The queue and pool shall not be copied, moved or assigned.

Queue locking, stop signalling and joining together determine whether a conversion task is executed and whether its storage remains alive.

APPROVED
COMMAND_LINE_TOOLS
IF_CPP, THREAD_SAFE_BUILD
Analysis, Inspection

Inspect mutex ownership and FIFO removal, stop/drain ordering, and joins before queue destruction. Exercise multiple producers/consumers with uniquely numbered nonthrowing work and verify no lost or repeated invocation. Check the one-worker fallback and verify that a failure during partial construction stops and joins every started worker.

demos/ppl_lcdd/Thread_Pool_defs.hh; demos/ppl_lcdd/Thread_Pool_templates.hh; demos/ppl_lcdd/ppl_lcdd.cc.

CPP
Internal

Internal templates in the conversion tool:

template <typename T> class Threadsafe_Queue;
template <typename Work> class Thread_Pool;

Queue operations: empty, push and try_pop. Pool operations: construction, submit, finalize and destruction. work_type names Work. The pool chooses its worker count from std::thread::hardware_concurrency, using one worker if that value is zero and capping the count by a positive task count when provided.